From 248fd2bc2443196dfab07f032ccbe1e43eaffe2e Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 30 Mar 2009 18:45:36 +0000 Subject: [PATCH] Simplify more code by using SVal::getAsSymbol() instead of loc::SymbolVal/nonloc::SymbolVal probing. llvm-svn: 68049 --- clang/lib/Analysis/GRState.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/clang/lib/Analysis/GRState.cpp b/clang/lib/Analysis/GRState.cpp index 7399ad4e2204..82cb1f24c41d 100644 --- a/clang/lib/Analysis/GRState.cpp +++ b/clang/lib/Analysis/GRState.cpp @@ -243,12 +243,9 @@ bool ScanReachableSymbols::scan(nonloc::CompoundVal val) { bool ScanReachableSymbols::scan(SVal val) { if (loc::MemRegionVal *X = dyn_cast(&val)) return scan(X->getRegion()); - - if (loc::SymbolVal *X = dyn_cast(&val)) - return visitor.VisitSymbol(X->getSymbol()); - - if (nonloc::SymbolVal *X = dyn_cast(&val)) - return visitor.VisitSymbol(X->getSymbol()); + + if (SymbolRef Sym = val.getAsSymbol()) + return visitor.VisitSymbol(Sym); if (nonloc::CompoundVal *X = dyn_cast(&val)) return scan(*X); @@ -304,12 +301,9 @@ bool GRStateManager::isEqual(const GRState* state, Expr* Ex, if (nonloc::ConcreteInt* X = dyn_cast(&V)) return X->getValue() == Y; - if (nonloc::SymbolVal* X = dyn_cast(&V)) - return ConstraintMgr->isEqual(state, X->getSymbol(), Y); - - if (loc::SymbolVal* X = dyn_cast(&V)) - return ConstraintMgr->isEqual(state, X->getSymbol(), Y); - + if (SymbolRef Sym = V.getAsSymbol()) + return ConstraintMgr->isEqual(state, Sym, Y); + return false; }