From: Ted Kremenek Date: Mon, 30 Mar 2009 18:45:36 +0000 (+0000) Subject: Simplify more code by using SVal::getAsSymbol() instead of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=380022d9072ebc3b2b1050098be6da8de4d03e0e;p=clang Simplify more code by using SVal::getAsSymbol() instead of loc::SymbolVal/nonloc::SymbolVal probing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68049 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 7399ad4e22..82cb1f24c4 100644 --- a/lib/Analysis/GRState.cpp +++ b/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; }