CursorVisitor: migrate GotoStmt to data-recursive algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118960 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 8be7882..9e6a439 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -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.