From 029c8f37e32b08bad4c757848a695d199fe5c813 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 8 Mar 2013 02:32:29 +0000 Subject: [PATCH] [libclang] When calling the function of CXCursorAndRangeVisitor, don't forget to stop visitation if it returns CXVisit_Break. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176681 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/CIndexHigh.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/libclang/CIndexHigh.cpp b/tools/libclang/CIndexHigh.cpp index af386d2276..7e12386841 100644 --- a/tools/libclang/CIndexHigh.cpp +++ b/tools/libclang/CIndexHigh.cpp @@ -205,8 +205,9 @@ static enum CXChildVisitResult findFileIdRefVisit(CXCursor cursor, return CXChildVisit_Recurse; } - data->visitor.visit(data->visitor.context, cursor, - cxloc::translateSourceRange(Ctx, Loc)); + if (data->visitor.visit(data->visitor.context, cursor, + cxloc::translateSourceRange(Ctx, Loc)) == CXVisit_Break) + return CXChildVisit_Break; } return CXChildVisit_Recurse; } @@ -300,8 +301,9 @@ static enum CXChildVisitResult findFileMacroRefVisit(CXCursor cursor, return CXChildVisit_Continue; } - data->visitor.visit(data->visitor.context, cursor, - cxloc::translateSourceRange(Ctx, Loc)); + if (data->visitor.visit(data->visitor.context, cursor, + cxloc::translateSourceRange(Ctx, Loc)) == CXVisit_Break) + return CXChildVisit_Break; return CXChildVisit_Continue; } -- 2.40.0