Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -827,8 +827,7 @@ /// the statement is a call that was inlined, we add the visitor to the /// bug report, so it can print a note later. static void addVisitorIfNecessary(const ExplodedNode *Node, const Stmt *S, - BugReport &BR, - bool InEnableNullFPSuppression) { + BugReport &BR, bool IsNullFPSuppression) { if (!CallEvent::isCallStmt(S)) return; @@ -877,11 +876,11 @@ // See if the return value is NULL. If so, suppress the report. AnalyzerOptions &Options = State->getAnalysisManager().options; + // If we have a value at the return side do not write out it is being null. bool EnableNullFPSuppression = false; - if (InEnableNullFPSuppression && - Options.ShouldSuppressNullReturnPaths) + if (IsNullFPSuppression && Options.ShouldSuppressNullReturnPaths) if (Optional RetLoc = RetVal.getAs()) - EnableNullFPSuppression = State->isNull(*RetLoc).isConstrainedTrue(); + EnableNullFPSuppression = true; BR.markInteresting(CalleeContext); BR.addVisitor(llvm::make_unique(CalleeContext, Index: clang/test/Analysis/diagnostics/find_last_store.c =================================================================== --- clang/test/Analysis/diagnostics/find_last_store.c +++ clang/test/Analysis/diagnostics/find_last_store.c @@ -1,4 +1,9 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core \ +// RUN: -analyzer-config suppress-null-return-paths=false \ +// RUN: -analyzer-output=text -verify %s + +// FIXME: Make it work with suppress-null-return-paths=true. + typedef struct { float b; } c; void *a(); void *d() { Index: clang/test/Analysis/inlining/false-positive-suppression.cpp =================================================================== --- clang/test/Analysis/inlining/false-positive-suppression.cpp +++ clang/test/Analysis/inlining/false-positive-suppression.cpp @@ -1,5 +1,13 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config suppress-null-return-paths=false -verify %s -// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify -DSUPPRESSED=1 %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core \ +// RUN: -analyzer-config suppress-null-return-paths=false \ +// RUN: -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=core \ +// RUN: -DSUPPRESSED=1 \ +// RUN: -verify %s + +#ifdef SUPPRESSED +// expected-no-diagnostics +#endif namespace rdar12676053 { // Delta-reduced from a preprocessed file. @@ -85,7 +93,10 @@ int *&box2 = m.getValue(i); box2 = 0; - *box2 = 1; // expected-warning {{Dereference of null pointer}} + *box2 = 1; +#ifndef SUPPRESSED + // expected-warning@-2 {{Dereference of null pointer}} +#endif } SomeClass *&getSomeClass() {