diff --git a/clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp @@ -87,7 +87,12 @@ auto R = std::make_unique(NullDereferenceBugType, OS.str(), ErrNode); R->markInteresting(DerefRegion); - C.emitReport(std::move(R)); + const Expr *BugExpr = Call.getOriginExpr(); + const ProgramStateRef State = C.getState(); + if (const ExplodedNode *E = C.generateNonFatalErrorNode(State)) { + bugreporter::trackExpressionValue(E, BugExpr, *R); + C.emitReport(std::move(R)); + } } void SmartPtrChecker::explainDereference(llvm::raw_ostream &OS, diff --git a/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp b/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp --- a/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp @@ -464,7 +464,7 @@ if (&BR.getBugType() != smartptr::getNullDereferenceBugType() || !BR.isInteresting(ThisRegion)) return; - if (!State->assume(InnerPointerVal.castAs(), true)) + if (!BR.isInteresting(InnerPointerVal) || !BR.isInteresting(InnerPointerVal.getAsSymbol())) return; if (ThisRegion->canPrintPretty()) { OS << "Obtained null inner pointer from";