diff options
| author | George Karpenkov <ekarpenkov@apple.com> | 2018-06-12 20:51:19 +0000 |
|---|---|---|
| committer | George Karpenkov <ekarpenkov@apple.com> | 2018-06-12 20:51:19 +0000 |
| commit | cd45bef232eb6d9c41a4f027207dd120ff390ba3 (patch) | |
| tree | 41ce2fa0b9c1bc92e4b14aca44d47107e162563d /clang/lib/StaticAnalyzer | |
| parent | 1cf8cdc68738189c27c88f4ca9d9aa51edc2ec95 (diff) | |
| download | bcm5719-llvm-cd45bef232eb6d9c41a4f027207dd120ff390ba3.tar.gz bcm5719-llvm-cd45bef232eb6d9c41a4f027207dd120ff390ba3.zip | |
[analyzer] [NFC] Remove "removeInvalidation" from visitor API
removeInvalidation is a very problematic API, as it makes suppression
order-dependent.
Moreover, it was used only once, and could be rewritten in a much
cleaner way.
Differential Revision: https://reviews.llvm.org/D48045
llvm-svn: 334542
Diffstat (limited to 'clang/lib/StaticAnalyzer')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 75126c6c378..3cac6cb3284 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -616,6 +616,7 @@ class ReturnVisitor : public BugReporterVisitorImpl<ReturnVisitor> { } Mode = Initial; bool EnableNullFPSuppression; + bool ShouldInvalidate = true; public: ReturnVisitor(const StackFrameContext *Frame, bool Suppressed) @@ -845,7 +846,7 @@ public: 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. @@ -873,7 +874,7 @@ public: void finalizeVisitor(BugReporterContext &BRC, const ExplodedNode *N, BugReport &BR) override { - if (EnableNullFPSuppression) + if (EnableNullFPSuppression && ShouldInvalidate) BR.markInvalid(ReturnVisitor::getTag(), StackFrame); } }; |

