]> granicus.if.org Git - clang/commitdiff
[analyzer] CheckerContext updates checkDst in it's destructor, so make sure the objec...
authorAnna Zaks <ganna@apple.com>
Tue, 11 Oct 2011 17:29:59 +0000 (17:29 +0000)
committerAnna Zaks <ganna@apple.com>
Tue, 11 Oct 2011 17:29:59 +0000 (17:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141683 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/CheckerManager.cpp

index 948ac1729cbd30c72c3689d82d514c9d2bd5c628..acacfb0e18c63dbc21a0d0295e759d7cebba56f7 100644 (file)
@@ -445,9 +445,13 @@ void CheckerManager::runCheckersForEvalCall(ExplodedNodeSet &Dst,
       ProgramPoint::Kind K = ProgramPoint::PostStmtKind;
       const ProgramPoint &L = ProgramPoint::getProgramPoint(CE, K,
                                 Pred->getLocationContext(), EI->Checker);
-
-      CheckerContext C(checkDst, Eng.getBuilder(), Eng, Pred, L, 0);
-      bool evaluated = (*EI)(CE, C);
+      bool evaluated = false;
+      { // CheckerContext generates transitions(populates checkDest) on
+        // destruction, so introduce the scope to make sure it gets properly
+        // populated.
+        CheckerContext C(checkDst, Eng.getBuilder(), Eng, Pred, L, 0);
+        evaluated = (*EI)(CE, C);
+      }
       assert(!(evaluated && anyEvaluated)
              && "There are more than one checkers evaluating the call");
       if (evaluated) {