parent
ec63c85505
commit
d4dacb05cc
|
@ -24,11 +24,16 @@ 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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue