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;
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;