]> granicus.if.org Git - clang/commitdiff
Add method ParentMap::addStmt().
authorTed Kremenek <kremenek@apple.com>
Mon, 15 Nov 2010 20:54:24 +0000 (20:54 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 15 Nov 2010 20:54:24 +0000 (20:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119181 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ParentMap.h
lib/AST/ParentMap.cpp

index f826e1117b66c73595d710dc13dc477b9eec796b..600321268e53ac6b614bf0dfc4efd2aed9cd3d95 100644 (file)
@@ -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;
 
index 5fe873acf7ac2b4ee6101749c7f1a4ca1bc11952..21847f28217bd0b14dd78c7ee58811251c39b404 100644 (file)
@@ -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);