Author: Sam McCall Date: 2022-01-21T23:18:23+01:00 New Revision: 653b007dc186845699d330c66dc9dfb3aaf396df
URL: https://github.com/llvm/llvm-project/commit/653b007dc186845699d330c66dc9dfb3aaf396df DIFF: https://github.com/llvm/llvm-project/commit/653b007dc186845699d330c66dc9dfb3aaf396df.diff LOG: [CodeComplete] fix nullptr crash in 612f5ed8823120 Added: Modified: clang/lib/Sema/SemaCodeComplete.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index cc08dee26613..b86bfe869c69 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -5519,9 +5519,10 @@ QualType getApproximateType(const Expr *E) { : getApproximateType(CDSME->getBase()); if (CDSME->isArrow() && !Base.isNull()) Base = Base->getPointeeType(); // could handle unique_ptr etc here? - auto *RD = Base.isNull() - ? nullptr - : llvm::dyn_cast<CXXRecordDecl>(getAsRecordDecl(Base)); + auto *RD = + Base.isNull() + ? nullptr + : llvm::dyn_cast_or_null<CXXRecordDecl>(getAsRecordDecl(Base)); if (RD && RD->isCompleteDefinition()) { // Look up member heuristically, including in bases. for (const auto *Member : RD->lookupDependentName( _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits