[llvm-branch-commits] [cfe-branch] r119641 - /cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 17 18:37:11 PST 2010


Author: ddunbar
Date: Wed Nov 17 20:37:11 2010
New Revision: 119641

URL: http://llvm.org/viewvc/llvm-project?rev=119641&view=rev
Log:
Merge r118986:
--
Author: Ted Kremenek <kremenek at apple.com>
Date:   Sat Nov 13 05:38:03 2010 +0000

    CursorVisitor: special-case CompoundStmt in data-recursion algorithm so we don't have to enqueue
    its children and then reverse them.

Modified:
    cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp

Modified: cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp?rev=119641&r1=119640&r2=119641&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Wed Nov 17 20:37:11 2010
@@ -1764,6 +1764,7 @@
 
   void VisitBlockExpr(BlockExpr *B);
   void VisitCompoundLiteralExpr(CompoundLiteralExpr *E);
+  void VisitCompoundStmt(CompoundStmt *S);
   void VisitCXXOperatorCallExpr(CXXOperatorCallExpr *E);
   void VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E);
   void VisitDeclRefExpr(DeclRefExpr *D);
@@ -1821,6 +1822,12 @@
   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.





More information about the llvm-branch-commits mailing list