r334542 - [analyzer] [NFC] Remove "removeInvalidation" from visitor API
George Karpenkov via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 12 13:51:19 PDT 2018
Author: george.karpenkov
Date: Tue Jun 12 13:51:19 2018
New Revision: 334542
URL: http://llvm.org/viewvc/llvm-project?rev=334542&view=rev
Log:
[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
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h?rev=334542&r1=334541&r2=334542&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h Tue Jun 12 13:51:19 2018
@@ -253,13 +253,6 @@ public:
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.
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=334542&r1=334541&r2=334542&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Tue Jun 12 13:51:19 2018
@@ -616,6 +616,7 @@ class ReturnVisitor : public BugReporter
} 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);
}
};
More information about the cfe-commits
mailing list