From 1876bf6a23f33121591b5b2ef1cc0574b79a3e08 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 13 Nov 2010 00:58:15 +0000 Subject: [PATCH] CursorVisitor: migrate GotoStmt to data-recursive algorithm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118960 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/CIndex.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 8be7882b69..9e6a439fdb 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -309,7 +309,6 @@ public: // Statement visitors bool VisitStmt(Stmt *S); - bool VisitGotoStmt(GotoStmt *S); // Expression visitors bool VisitDeclRefExpr(DeclRefExpr *E); @@ -345,6 +344,7 @@ bool Visit##NAME(NAME *S) { return VisitDataRecursive(S); } 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 @@ bool CursorVisitor::VisitStmt(Stmt *S) { 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 @@ bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) { CXCursor Cursor = MakeCXCursor(S, StmtParent, TU); switch (S->getStmtClass()) { + case Stmt::GotoStmtClass: { + GotoStmt *GS = cast(S); + if (Visit(MakeCursorLabelRef(GS->getLabel(), + GS->getLabelLoc(), TU))) { + return true; + } + continue; + } default: { // FIXME: this entire switch stmt will eventually // go away. -- 2.40.0