Add ParentMap:getParentIgnoreParens().

llvm-svn: 71469
This commit is contained in:
Ted Kremenek 2009-05-11 19:49:27 +00:00
parent ec63c85505
commit d4dacb05cc
2 changed files with 12 additions and 2 deletions

View File

@ -24,12 +24,17 @@ public:
ParentMap(Stmt* ASTRoot);
~ParentMap();
Stmt* getParent(Stmt*) const;
Stmt *getParent(Stmt*) const;
Stmt *getParentIgnoreParens(Stmt *) const;
const Stmt* getParent(const Stmt* S) const {
const Stmt *getParent(const Stmt* S) const {
return getParent(const_cast<Stmt*>(S));
}
const Stmt *getParentIgnoreParens(const Stmt *S) const {
return getParentIgnoreParens(const_cast<Stmt*>(S));
}
bool hasParent(Stmt* S) const {
return getParent(S) != 0;
}

View File

@ -46,6 +46,11 @@ Stmt* ParentMap::getParent(Stmt* S) const {
return I == M->end() ? 0 : I->second;
}
Stmt *ParentMap::getParentIgnoreParens(Stmt *S) const {
do { S = getParent(S); } while (S && isa<ParenExpr>(S));
return S;
}
bool ParentMap::isConsumedExpr(Expr* E) const {
Stmt *P = getParent(E);
Stmt *DirectChild = E;