Index: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h =================================================================== --- clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -248,13 +248,6 @@ void markInvalid(const void *Tag, const void *Data) { Invalidations.insert(std::make_pair(Tag, Data)); } - - /// Reverses the effects of a previous invalidation. - /// - /// \sa markInvalid - void removeInvalidation(const void *Tag, const void *Data) { - Invalidations.erase(std::make_pair(Tag, Data)); - } /// Return the canonical declaration, be it a method or class, where /// this issue semantically occurred. Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -613,6 +613,7 @@ } Mode = Initial; bool EnableNullFPSuppression; + bool ShouldInvalidate = true; public: ReturnVisitor(const StackFrameContext *Frame, bool Suppressed) @@ -842,7 +843,7 @@ if (bugreporter::trackNullOrUndefValue(N, ArgE, BR, /*IsArg=*/true, EnableNullFPSuppression)) - BR.removeInvalidation(ReturnVisitor::getTag(), StackFrame); + ShouldInvalidate = false; // If we /can't/ track the null pointer, we should err on the side of // false negatives, and continue towards marking this report invalid. @@ -870,7 +871,7 @@ void finalizeVisitor(BugReporterContext &BRC, const ExplodedNode *N, BugReport &BR) override { - if (EnableNullFPSuppression) + if (EnableNullFPSuppression && ShouldInvalidate) BR.markInvalid(ReturnVisitor::getTag(), StackFrame); } };