[llvm-branch-commits] [cfe-branch] r71499 - in /cfe/branches/Apple/Dib: include/clang/AST/ParentMap.h lib/AST/ParentMap.cpp
Mike Stump
mrs at apple.com
Mon May 11 16:21:21 PDT 2009
Author: mrs
Date: Mon May 11 18:21:21 2009
New Revision: 71499
URL: http://llvm.org/viewvc/llvm-project?rev=71499&view=rev
Log:
Merge in 71469:
Add ParentMap:getParentIgnoreParens().
Modified:
cfe/branches/Apple/Dib/include/clang/AST/ParentMap.h
cfe/branches/Apple/Dib/lib/AST/ParentMap.cpp
Modified: cfe/branches/Apple/Dib/include/clang/AST/ParentMap.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/AST/ParentMap.h?rev=71499&r1=71498&r2=71499&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/include/clang/AST/ParentMap.h (original)
+++ cfe/branches/Apple/Dib/include/clang/AST/ParentMap.h Mon May 11 18:21:21 2009
@@ -24,11 +24,16 @@
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;
Modified: cfe/branches/Apple/Dib/lib/AST/ParentMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/AST/ParentMap.cpp?rev=71499&r1=71498&r2=71499&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/lib/AST/ParentMap.cpp (original)
+++ cfe/branches/Apple/Dib/lib/AST/ParentMap.cpp Mon May 11 18:21:21 2009
@@ -46,6 +46,11 @@
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;
More information about the llvm-branch-commits
mailing list