[cfe-commits] r60808 - /cfe/trunk/lib/Analysis/BasicStore.cpp

Ted Kremenek kremenek at apple.com
Tue Dec 9 15:50:59 PST 2008


Author: kremenek
Date: Tue Dec  9 17:50:57 2008
New Revision: 60808

URL: http://llvm.org/viewvc/llvm-project?rev=60808&view=rev
Log:
Fix to BasicStoreManager::getElementLValue: If the base region is a symbol, layer an AnonTypedRegion on top of it.

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

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicStore.cpp Tue Dec  9 17:50:57 2008
@@ -174,9 +174,20 @@
   const MemRegion* BaseR = 0;
   
   switch(BaseL.getSubKind()) {
-    case loc::SymbolValKind:
-      BaseR = MRMgr.getSymbolicRegion(cast<loc::SymbolVal>(&BaseL)->getSymbol());
+    case loc::SymbolValKind: {
+      // FIXME: Should we have symbolic regions be typed or typeless?
+      //  Here we assume that these regions are typeless, even though the
+      //  symbol is typed.
+      SymbolRef Sym = cast<loc::SymbolVal>(&BaseL)->getSymbol();
+      // Create a region to represent this symbol.
+      // FIXME: In the future we may just use symbolic regions instead of
+      //  SymbolVals to reason about symbolic memory chunks.
+      const MemRegion* SymR = MRMgr.getSymbolicRegion(Sym);
+      // Layered a typed region on top of this.
+      QualType T = StateMgr.getSymbolManager().getType(Sym);
+      BaseR = MRMgr.getAnonTypedRegion(T, SymR);
       break;
+    }
       
     case loc::GotoLabelKind:
     case loc::FuncValKind:





More information about the cfe-commits mailing list