ソースを参照

Add method ParentMap::addStmt().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119181 91177308-0d34-0410-b5e6-96231b3b80d8
Ted Kremenek 14 年 前
コミット
d6543f8bba
2 ファイル変更11 行追加0 行削除
  1. 5 0
      include/clang/AST/ParentMap.h
  2. 6 0
      lib/AST/ParentMap.cpp

+ 5 - 0
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;
 

+ 6 - 0
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);