diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-11-13 05:38:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-11-13 05:38:03 +0000 |
commit | 083c7e2d564033af87e507fbbd02f1c77ff462b1 (patch) | |
tree | c14927de53bbfc6e899fcae3ab3cc6308869f665 | |
parent | ed02366ddad2dd8e596fcf3257328f7aec2b86f9 (diff) |
CursorVisitor: special-case CompoundStmt in data-recursion algorithm so we don't have to enqueue
its children and then reverse them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118986 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/libclang/CIndex.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index a20e739896..e87ec059b5 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1749,6 +1749,7 @@ public: void VisitBlockExpr(BlockExpr *B); void VisitCompoundLiteralExpr(CompoundLiteralExpr *E); + void VisitCompoundStmt(CompoundStmt *S); void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E); void VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E); void VisitDeclRefExpr(DeclRefExpr *D); @@ -1806,6 +1807,12 @@ void EnqueueVisitor::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { EnqueueChildren(E); AddTypeLoc(E->getTypeSourceInfo()); } +void EnqueueVisitor::VisitCompoundStmt(CompoundStmt *S) { + for (CompoundStmt::reverse_body_iterator I = S->body_rbegin(), + E = S->body_rend(); I != E; ++I) { + AddStmt(*I); + } +} void EnqueueVisitor::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *CE) { // Note that we enqueue things in reverse order so that // they are visited correctly by the DFS. |