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

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Nov 3 12:02:28 PDT 2011


Author: akirtzidis
Date: Thu Nov  3 14:02:28 2011
New Revision: 143637

URL: http://llvm.org/viewvc/llvm-project?rev=143637&view=rev
Log:
[libclang] Use CursorVisitor::Visit instead of invoking the visitor directly.

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=143637&r1=143636&r2=143637&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Nov  3 14:02:28 2011
@@ -219,10 +219,6 @@
   /// \param R a half-open source range retrieved from the abstract syntax tree.
   RangeComparisonResult CompareRegionOfInterest(SourceRange R);
 
-  CXChildVisitResult invokeVisitor(CXCursor cursor, CXCursor parent) {
-    return Visitor(cursor, parent, ClientData);
-  }
-
   void visitDeclsFromFileRegion(FileID File, unsigned Offset, unsigned Length);
 
   class SetParentRAII {
@@ -482,9 +478,7 @@
                                              unsigned Offset, unsigned Length) {
   ASTUnit *Unit = static_cast<ASTUnit *>(TU->TUData);
   SourceManager &SM = Unit->getSourceManager();
-
   SourceRange Range = RegionOfInterest;
-  CXCursor Parent = clang_getTranslationUnitCursor(TU);
 
   SmallVector<Decl *, 16> Decls;
   Unit->findFileRegionDecls(File, Offset, Length, Decls);
@@ -536,14 +530,8 @@
 
     assert(CompRes == RangeOverlap);
     VisitedAtLeastOnce = true;
-    CXCursor C = MakeCXCursor(D, TU, Range);
-    CXChildVisitResult
-      Res = invokeVisitor(C, Parent);
-    if (Res == CXChildVisit_Break)
+    if (Visit(MakeCXCursor(D, TU, Range), /*CheckedRegionOfInterest=*/true))
       break;
-    if (Res == CXChildVisit_Recurse)
-      if (VisitChildren(C))
-        break;
   }
 
   if (VisitedAtLeastOnce)
@@ -562,11 +550,7 @@
       break;
 
     if (RangeCompare(SM, CurDeclRange, Range) == RangeOverlap) {
-      CXCursor C = MakeCXCursor(D, TU, Range);
-      CXChildVisitResult
-        Res = invokeVisitor(C, Parent);
-      if (Res == CXChildVisit_Recurse)
-        VisitChildren(C);
+      Visit(MakeCXCursor(D, TU, Range), /*CheckedRegionOfInterest=*/true);
       break;
     }
 





More information about the cfe-commits mailing list