[cfe-commits] r118960 - /cfe/trunk/tools/libclang/CIndex.cpp

Ted Kremenek kremenek at apple.com
Fri Nov 12 16:58:15 PST 2010


Author: kremenek
Date: Fri Nov 12 18:58:15 2010
New Revision: 118960

URL: http://llvm.org/viewvc/llvm-project?rev=118960&view=rev
Log:
CursorVisitor: migrate GotoStmt to data-recursive algorithm.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=118960&r1=118959&r2=118960&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Nov 12 18:58:15 2010
@@ -309,7 +309,6 @@
 
   // Statement visitors
   bool VisitStmt(Stmt *S);
-  bool VisitGotoStmt(GotoStmt *S);
 
   // Expression visitors
   bool VisitDeclRefExpr(DeclRefExpr *E);
@@ -345,6 +344,7 @@
   DATA_RECURSIVE_VISIT(IfStmt)
   DATA_RECURSIVE_VISIT(InitListExpr)
   DATA_RECURSIVE_VISIT(ForStmt)
+  DATA_RECURSIVE_VISIT(GotoStmt)
   DATA_RECURSIVE_VISIT(MemberExpr)
   DATA_RECURSIVE_VISIT(ObjCMessageExpr)
   DATA_RECURSIVE_VISIT(OverloadExpr)
@@ -1438,10 +1438,6 @@
   return false;
 }
 
-bool CursorVisitor::VisitGotoStmt(GotoStmt *S) {
-  return Visit(MakeCursorLabelRef(S->getLabel(), S->getLabelLoc(), TU));
-}
-
 bool CursorVisitor::VisitDeclRefExpr(DeclRefExpr *E) {
   // Visit nested-name-specifier, if present.
   if (NestedNameSpecifier *Qualifier = E->getQualifier())
@@ -1966,6 +1962,14 @@
         CXCursor Cursor = MakeCXCursor(S, StmtParent, TU);
         
         switch (S->getStmtClass()) {
+          case Stmt::GotoStmtClass: {
+            GotoStmt *GS = cast<GotoStmt>(S);
+            if (Visit(MakeCursorLabelRef(GS->getLabel(),
+                                         GS->getLabelLoc(), TU))) {
+              return true;
+            }
+            continue;
+          } 
           default: {
             // FIXME: this entire switch stmt will eventually
             // go away.





More information about the cfe-commits mailing list