]> granicus.if.org Git - clang/commitdiff
Fix regression when invalidating reference-counts for objects passed-by-reference...
authorTed Kremenek <kremenek@apple.com>
Thu, 18 Dec 2008 23:34:57 +0000 (23:34 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 18 Dec 2008 23:34:57 +0000 (23:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61224 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp

index c85d934ebb7b287f0c196ed13c024d0f59882654..90a54d635309fb595cef5fa8ef96d167e5ece652 100644 (file)
@@ -1589,14 +1589,6 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
         //  to identify conjured symbols by an expression pair: the enclosing
         //  expression (the context) and the expression itself.  This should
         //  disambiguate conjured symbols. 
-
-        // Is the invalidated variable something that we were tracking?
-        SVal X = state.GetSVal(*MR);
-        
-        if (isa<loc::SymbolVal>(X)) {
-          SymbolRef Sym = cast<loc::SymbolVal>(X).getSymbol();
-          state = state.remove<RefBindings>(Sym);
-        }
         
         const TypedRegion* R = dyn_cast<TypedRegion>(MR->getRegion());
         
@@ -1608,6 +1600,15 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
         }
         
         if (R) {
+          
+          // Is the invalidated variable something that we were tracking?
+          SVal X = state.GetSVal(Loc::MakeVal(R));
+          
+          if (isa<loc::SymbolVal>(X)) {
+            SymbolRef Sym = cast<loc::SymbolVal>(X).getSymbol();
+            state = state.remove<RefBindings>(Sym);
+          }
+          
           // Set the value of the variable to be a conjured symbol.
           unsigned Count = Builder.getCurrentBlockCount();
           QualType T = R->getRValueType(Ctx);