]> granicus.if.org Git - clang/commitdiff
[analyzer] Address Jordan’s review of r177138 (a micro optimization)
authorAnna Zaks <ganna@apple.com>
Fri, 15 Mar 2013 23:34:22 +0000 (23:34 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 15 Mar 2013 23:34:22 +0000 (23:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177204 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/BugReporterVisitors.cpp

index bf616b1d267dd1c42c1a4968c8f2b72a29656daa..d5b4714451dc0f5d4f15031b64b22339f27d4988 100644 (file)
@@ -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()) {