aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-03-15 23:34:22 +0000
committerAnna Zaks <ganna@apple.com>2013-03-15 23:34:22 +0000
commitf8ba81e8bbc4d0d424c3b4c3581a9467e972c4de (patch)
treee9c0498fed49c46b58dc56bfd0ed621936d16abc
parent316dd5467bed9242088149fe92f3316ef4f235e9 (diff)
[analyzer] Address Jordan’s review of r177138 (a micro optimization)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177204 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index bf616b1d26..d5b4714451 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -701,6 +701,14 @@ TrackConstraintBRVisitor::VisitNode(const ExplodedNode *N,
SuppressInlineDefensiveChecksVisitor::
SuppressInlineDefensiveChecksVisitor(DefinedSVal Value, const ExplodedNode *N)
: V(Value), IsSatisfied(false), IsTrackingTurnedOn(false) {
+
+ // Check if the visitor is disabled.
+ SubEngine *Eng = N->getState()->getStateManager().getOwningEngine();
+ assert(Eng && "Cannot file a bug report without an owning engine");
+ AnalyzerOptions &Options = Eng->getAnalysisManager().options;
+ if (!Options.shouldSuppressInlinedDefensiveChecks())
+ IsSatisfied = true;
+
assert(N->getState()->isNull(V).isConstrainedTrue() &&
"The visitor only tracks the cases where V is constrained to 0");
}
@@ -730,11 +738,6 @@ SuppressInlineDefensiveChecksVisitor::VisitNode(const ExplodedNode *Succ,
if (!IsTrackingTurnedOn)
return 0;
- AnalyzerOptions &Options =
- BRC.getBugReporter().getEngine().getAnalysisManager().options;
- if (!Options.shouldSuppressInlinedDefensiveChecks())
- return 0;
-
// Check if in the previous state it was feasible for this value
// to *not* be null.
if (!Pred->getState()->isNull(V).isConstrainedTrue()) {