Skip to content
Snippets Groups Projects
Commit 64595fad authored by Anna Zaks's avatar Anna Zaks
Browse files

[analyzer] Add a helper method.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144927 91177308-0d34-0410-b5e6-96231b3b80d8
parent e24f5fc8
No related branches found
No related tags found
No related merge requests found
...@@ -136,6 +136,8 @@ public: ...@@ -136,6 +136,8 @@ public:
/// return that expression. Otherwise return NULL. /// return that expression. Otherwise return NULL.
const SymExpr *getAsSymbolicExpression() const; const SymExpr *getAsSymbolicExpression() const;
const SymExpr* getAsSymExpr() const;
const MemRegion *getAsRegion() const; const MemRegion *getAsRegion() const;
void dumpToStream(raw_ostream &OS) const; void dumpToStream(raw_ostream &OS) const;
......
...@@ -114,6 +114,13 @@ const SymExpr *SVal::getAsSymbolicExpression() const { ...@@ -114,6 +114,13 @@ const SymExpr *SVal::getAsSymbolicExpression() const {
return getAsSymbol(); return getAsSymbol();
} }
const SymExpr* SVal::getAsSymExpr() const {
const SymExpr* Sym = getAsSymbol();
if (!Sym)
Sym = getAsSymbolicExpression();
return Sym;
}
const MemRegion *SVal::getAsRegion() const { const MemRegion *SVal::getAsRegion() const {
if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(this)) if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(this))
return X->getRegion(); return X->getRegion();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment