diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-02-13 01:24:19 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-02-13 01:24:19 +0000 |
commit | a36dd12e443224afc896e35a81d7cf829578e787 (patch) | |
tree | 99d0cfa20d9c1a1ab20730d764ad62e82a56c695 /clang/lib | |
parent | d2759212b8af303defe89d524c4d8be6ff8e2821 (diff) | |
download | bcm5719-llvm-a36dd12e443224afc896e35a81d7cf829578e787.tar.gz bcm5719-llvm-a36dd12e443224afc896e35a81d7cf829578e787.zip |
[RecursiveASTVisitor] Introduce dataTraverseStmtPre()/dataTraverseStmtPost() to allow clients to do before/after actions during data recursive visitation.
This should fix the asan bot that hits stack overflow in a couple of test/Index tests.
llvm-svn: 260785
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Index/IndexBody.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp index 56fba28387d..f7164453db6 100644 --- a/clang/lib/Index/IndexBody.cpp +++ b/clang/lib/Index/IndexBody.cpp @@ -29,11 +29,15 @@ public: bool shouldWalkTypesOfTypeLocs() const { return false; } - bool TraverseStmt(Stmt *S) { + bool dataTraverseStmtPre(Stmt *S) { StmtStack.push_back(S); - bool ret = base::TraverseStmt(S); + return true; + } + + bool dataTraverseStmtPost(Stmt *S) { + assert(StmtStack.back() == S); StmtStack.pop_back(); - return ret; + return true; } bool TraverseTypeLoc(TypeLoc TL) { |