]> granicus.if.org Git - clang/commitdiff
CursorVisitor: special-case CompoundStmt in data-recursion algorithm so we don't...
authorTed Kremenek <kremenek@apple.com>
Sat, 13 Nov 2010 05:38:03 +0000 (05:38 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 13 Nov 2010 05:38:03 +0000 (05:38 +0000)
its children and then reverse them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118986 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index a20e73989635f92ac1823bddef4a99aa46378621..e87ec059b58062505e9a6903f3ffd6255b9909c4 100644 (file)
@@ -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.