Browse Source

[analyzer] CheckerContext updates checkDst in it's destructor, so make sure the object is destructed before checkDst is used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141683 91177308-0d34-0410-b5e6-96231b3b80d8
Anna Zaks 14 years ago
parent
commit
b1576f7136
1 changed files with 7 additions and 3 deletions
  1. 7 3
      lib/StaticAnalyzer/Core/CheckerManager.cpp

+ 7 - 3
lib/StaticAnalyzer/Core/CheckerManager.cpp

@@ -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) {