[analyzer] Add a helper method.

Naming could be improved.. But we should first rename the classes in the SVal hierarchy.

llvm-svn: 144927
This commit is contained in:
Anna Zaks 2011-11-17 22:57:01 +00:00
parent 027bf11eb3
commit af36e9128a
2 changed files with 9 additions and 0 deletions

View File

@ -136,6 +136,8 @@ public:
/// return that expression. Otherwise return NULL.
const SymExpr *getAsSymbolicExpression() const;
const SymExpr* getAsSymExpr() const;
const MemRegion *getAsRegion() const;
void dumpToStream(raw_ostream &OS) const;

View File

@ -114,6 +114,13 @@ const SymExpr *SVal::getAsSymbolicExpression() const {
return getAsSymbol();
}
const SymExpr* SVal::getAsSymExpr() const {
const SymExpr* Sym = getAsSymbol();
if (!Sym)
Sym = getAsSymbolicExpression();
return Sym;
}
const MemRegion *SVal::getAsRegion() const {
if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(this))
return X->getRegion();