[cfe-commits] r68049 - /cfe/trunk/lib/Analysis/GRState.cpp

Ted Kremenek kremenek at apple.com
Mon Mar 30 11:45:36 PDT 2009


Author: kremenek
Date: Mon Mar 30 13:45:36 2009
New Revision: 68049

URL: http://llvm.org/viewvc/llvm-project?rev=68049&view=rev
Log:
Simplify more code by using SVal::getAsSymbol() instead of
loc::SymbolVal/nonloc::SymbolVal probing.

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

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRState.cpp (original)
+++ cfe/trunk/lib/Analysis/GRState.cpp Mon Mar 30 13:45:36 2009
@@ -243,12 +243,9 @@
 bool ScanReachableSymbols::scan(SVal val) {
   if (loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(&val))
     return scan(X->getRegion());
-    
-  if (loc::SymbolVal *X = dyn_cast<loc::SymbolVal>(&val))
-    return visitor.VisitSymbol(X->getSymbol());
-  
-  if (nonloc::SymbolVal *X = dyn_cast<nonloc::SymbolVal>(&val))
-    return visitor.VisitSymbol(X->getSymbol());
+
+  if (SymbolRef Sym = val.getAsSymbol())
+    return visitor.VisitSymbol(Sym);
   
   if (nonloc::CompoundVal *X = dyn_cast<nonloc::CompoundVal>(&val))
     return scan(*X);
@@ -304,12 +301,9 @@
   if (nonloc::ConcreteInt* X = dyn_cast<nonloc::ConcreteInt>(&V))
     return X->getValue() == Y;
     
-  if (nonloc::SymbolVal* X = dyn_cast<nonloc::SymbolVal>(&V))
-    return ConstraintMgr->isEqual(state, X->getSymbol(), Y);
-  
-  if (loc::SymbolVal* X = dyn_cast<loc::SymbolVal>(&V))
-    return ConstraintMgr->isEqual(state, X->getSymbol(), Y);
-  
+  if (SymbolRef Sym = V.getAsSymbol())
+    return ConstraintMgr->isEqual(state, Sym, Y);
+
   return false;
 }
   





More information about the cfe-commits mailing list