[cfe-commits] r94034 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp tools/CIndex/CIndex.exports
Douglas Gregor
dgregor at apple.com
Wed Jan 20 13:37:00 PST 2010
Author: dgregor
Date: Wed Jan 20 15:37:00 2010
New Revision: 94034
URL: http://llvm.org/viewvc/llvm-project?rev=94034&view=rev
Log:
Kill clang_loadDeclaration() and clang_loadTranslationUnit().
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/tools/CIndex/CIndex.cpp
cfe/trunk/tools/CIndex/CIndex.exports
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=94034&r1=94033&r2=94034&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Wed Jan 20 15:37:00 2010
@@ -269,14 +269,16 @@
* TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
*
* // This will load all the symbols from 'IndexTest.pch'
- * clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
+ * clang_visitChildren(TU, clang_getTranslationUnitCursor(TU),
+ * TranslationUnitVisitor, 0);
* clang_disposeTranslationUnit(TU);
*
* // This will load all the symbols from 'IndexTest.c', excluding symbols
* // from 'IndexTest.pch'.
* char *args[] = { "-Xclang", "-include-pch=IndexTest.pch", 0 };
* TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args);
- * clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
+ * clang_loadTranslationUnit(TU, clang_getTranslationUnitCursor(TU),
+ * TranslationUnitVisitor, 0);
* clang_disposeTranslationUnit(TU);
*
* This process of creating the 'pch', loading it separately, and using it (via
@@ -341,58 +343,7 @@
const char **clang_command_line_args
);
-/*
- Usage: clang_loadTranslationUnit(). Will load the toplevel declarations
- within a translation unit, issuing a 'callback' for each one.
-
- void printObjCInterfaceNames(CXTranslationUnit X, CXCursor C) {
- if (clang_getCursorKind(C) == Cursor_Declaration) {
- CXDecl D = clang_getCursorDecl(C);
- if (clang_getDeclKind(D) == CXDecl_ObjC_interface)
- printf("@interface %s in file %s on line %d column %d\n",
- clang_getDeclSpelling(D), clang_getCursorSource(C),
- clang_getCursorLine(C), clang_getCursorColumn(C));
- }
- }
- static void usage {
- clang_loadTranslationUnit(CXTranslationUnit, printObjCInterfaceNames);
- }
-*/
typedef void *CXClientData;
-typedef void (*CXTranslationUnitIterator)(CXTranslationUnit, CXCursor,
- CXClientData);
-CINDEX_LINKAGE void clang_loadTranslationUnit(CXTranslationUnit,
- CXTranslationUnitIterator,
- CXClientData);
-
-/*
- Usage: clang_loadDeclaration(). Will load the declaration, issuing a
- 'callback' for each declaration/reference within the respective declaration.
-
- For interface declarations, this will index the super class, protocols,
- ivars, methods, etc. For structure declarations, this will index the fields.
- For functions, this will index the parameters (and body, for function
- definitions), local declarations/references.
-
- void getInterfaceDetails(CXDecl X, CXCursor C) {
- switch (clang_getCursorKind(C)) {
- case Cursor_ObjC_ClassRef:
- CXDecl SuperClass = clang_getCursorDecl(C);
- case Cursor_ObjC_ProtocolRef:
- CXDecl AdoptsProtocol = clang_getCursorDecl(C);
- case Cursor_Declaration:
- CXDecl AnIvarOrMethod = clang_getCursorDecl(C);
- }
- }
- static void usage() {
- if (clang_getDeclKind(D) == CXDecl_ObjC_interface) {
- clang_loadDeclaration(D, getInterfaceDetails);
- }
- }
-*/
-typedef void (*CXDeclIterator)(CXDecl, CXCursor, CXClientData);
-
-CINDEX_LINKAGE void clang_loadDeclaration(CXDecl, CXDeclIterator, CXClientData);
/**
* \brief Retrieve the cursor that represents the given translation unit.
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=94034&r1=94033&r2=94034&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Wed Jan 20 15:37:00 2010
@@ -517,67 +517,6 @@
return Result;
}
-struct LoadTranslationUnitData {
- CXTranslationUnit TU;
- CXTranslationUnitIterator Callback;
- CXClientData ClientData;
-};
-
-enum CXChildVisitResult LoadTranslationUnitVisitor(CXCursor cursor,
- CXCursor parent,
- CXClientData client_data) {
- LoadTranslationUnitData *Data
- = static_cast<LoadTranslationUnitData *>(client_data);
- Data->Callback(Data->TU, cursor, Data->ClientData);
- return CXChildVisit_Continue;
-}
-
-void clang_loadTranslationUnit(CXTranslationUnit CTUnit,
- CXTranslationUnitIterator callback,
- CXClientData CData) {
- assert(CTUnit && "Passed null CXTranslationUnit");
- ASTUnit *CXXUnit = static_cast<ASTUnit *>(CTUnit);
-
- unsigned PCHLevel = Decl::MaxPCHLevel;
-
- // Set the PCHLevel to filter out unwanted decls if requested.
- if (CXXUnit->getOnlyLocalDecls()) {
- PCHLevel = 0;
-
- // If the main input was an AST, bump the level.
- if (CXXUnit->isMainFileAST())
- ++PCHLevel;
- }
-
- LoadTranslationUnitData Data = { CTUnit, callback, CData };
-
- CursorVisitor CurVisitor(&LoadTranslationUnitVisitor, &Data, PCHLevel);
- CurVisitor.VisitChildren(clang_getTranslationUnitCursor(CTUnit));
-}
-
-struct LoadDeclarationData {
- CXDeclIterator Callback;
- CXClientData ClientData;
-};
-
-CXChildVisitResult LoadDeclarationVisitor(CXCursor cursor,
- CXCursor parent,
- CXClientData client_data) {
- LoadDeclarationData *Data = static_cast<LoadDeclarationData *>(client_data);
- Data->Callback(clang_getCursorDecl(cursor), cursor, Data->ClientData);
- return CXChildVisit_Recurse;
-}
-
-void clang_loadDeclaration(CXDecl Dcl,
- CXDeclIterator callback,
- CXClientData CData) {
- assert(Dcl && "Passed null CXDecl");
-
- LoadDeclarationData Data = { callback, CData };
- CursorVisitor CurVisit(&LoadDeclarationVisitor, &Data,
- static_cast<Decl *>(Dcl)->getPCHLevel());
- CurVisit.VisitChildren(clang_getCursorFromDecl(Dcl));
-}
} // end: extern "C"
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/tools/CIndex/CIndex.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.exports?rev=94034&r1=94033&r2=94034&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.exports (original)
+++ cfe/trunk/tools/CIndex/CIndex.exports Wed Jan 20 15:37:00 2010
@@ -42,7 +42,5 @@
_clang_isReference
_clang_isStatement
_clang_isTranslationUnit
-_clang_loadDeclaration
-_clang_loadTranslationUnit
_clang_setUseExternalASTGeneration
_clang_visitChildren
More information about the cfe-commits
mailing list