[cfe-commits] r61224 - /cfe/trunk/lib/Analysis/CFRefCount.cpp

Ted Kremenek kremenek at apple.com
Thu Dec 18 15:34:58 PST 2008


Author: kremenek
Date: Thu Dec 18 17:34:57 2008
New Revision: 61224

URL: http://llvm.org/viewvc/llvm-project?rev=61224&view=rev
Log:
Fix regression when invalidating reference-counts for objects passed-by-reference to a function/method.

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=61224&r1=61223&r2=61224&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Thu Dec 18 17:34:57 2008
@@ -1589,14 +1589,6 @@
         //  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 @@
         }
         
         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);





More information about the cfe-commits mailing list