diff options
-rw-r--r-- | include/clang/AST/ParentMap.h | 5 | ||||
-rw-r--r-- | lib/AST/ParentMap.cpp | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/clang/AST/ParentMap.h b/include/clang/AST/ParentMap.h index f826e1117b..600321268e 100644 --- a/include/clang/AST/ParentMap.h +++ b/include/clang/AST/ParentMap.h @@ -24,6 +24,11 @@ public: ParentMap(Stmt* ASTRoot); ~ParentMap(); + /// \brief Adds and/or updates the parent/child-relations of the complete + /// stmt tree of S. All children of S including indirect descendants are + /// visited and updated or inserted but not the parents of S. + void addStmt(Stmt* S); + Stmt *getParent(Stmt*) const; Stmt *getParentIgnoreParens(Stmt *) const; diff --git a/lib/AST/ParentMap.cpp b/lib/AST/ParentMap.cpp index 5fe873acf7..21847f2821 100644 --- a/lib/AST/ParentMap.cpp +++ b/lib/AST/ParentMap.cpp @@ -40,6 +40,12 @@ ParentMap::~ParentMap() { delete (MapTy*) Impl; } +void ParentMap::addStmt(Stmt* S) { + if (S) { + BuildParentMap(*(MapTy*) Impl, S); + } +} + Stmt* ParentMap::getParent(Stmt* S) const { MapTy* M = (MapTy*) Impl; MapTy::iterator I = M->find(S); |