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

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


Author: ddunbar
Date: Wed Nov 17 20:37:04 2010
New Revision: 119638

URL: http://llvm.org/viewvc/llvm-project?rev=119638&view=rev
Log:
Merge r118960:
--
Author: Ted Kremenek <kremenek at apple.com>
Date:   Sat Nov 13 00:58:15 2010 +0000

    CursorVisitor: migrate GotoStmt to data-recursive algorithm.

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=119638&r1=119637&r2=119638&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp (original)
+++ cfe/branches/Apple/whitney/tools/libclang/CIndex.cpp Wed Nov 17 20:37:04 2010
@@ -323,7 +323,6 @@
 
   // Statement visitors
   bool VisitStmt(Stmt *S);
-  bool VisitGotoStmt(GotoStmt *S);
 
   // Expression visitors
   bool VisitDeclRefExpr(DeclRefExpr *E);
@@ -359,6 +358,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)
@@ -1453,10 +1453,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())
@@ -1981,6 +1977,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 llvm-branch-commits mailing list