From 877524918a126cb18f07443c357e6c51177f5982 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 22 Jan 2010 20:35:53 +0000 Subject: [PATCH] Eliminate CIndex's dependency on the Clang Index library, since we weren't actually using any of its facilities. llvm-svn: 94210 --- clang/tools/CIndex/CIndex.cpp | 2 +- clang/tools/CIndex/CIndexUSRs.cpp | 4 ---- clang/tools/CIndex/CIndexer.h | 16 ++++------------ clang/tools/CIndex/CMakeLists.txt | 3 +-- clang/tools/CIndex/Makefile | 2 +- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index 3447553ae3fd..78fdaceb2cef 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -834,7 +834,7 @@ CXString CIndexer::createCXString(const char *String, bool DupString){ extern "C" { CXIndex clang_createIndex(int excludeDeclarationsFromPCH, int displayDiagnostics) { - CIndexer *CIdxr = new CIndexer(new Program()); + CIndexer *CIdxr = new CIndexer(); if (excludeDeclarationsFromPCH) CIdxr->setOnlyLocalDecls(); if (displayDiagnostics) diff --git a/clang/tools/CIndex/CIndexUSRs.cpp b/clang/tools/CIndex/CIndexUSRs.cpp index e7f852900212..fd605fb68d1b 100644 --- a/clang/tools/CIndex/CIndexUSRs.cpp +++ b/clang/tools/CIndex/CIndexUSRs.cpp @@ -17,10 +17,6 @@ #include "llvm/ADT/SmallString.h" #include "llvm/Support/raw_ostream.h" -static inline Program &GetProgram(CXIndex CIdx) { - return ((CIndexer*) CIdx)->getProgram(); -} - //===----------------------------------------------------------------------===// // USR generation. //===----------------------------------------------------------------------===// diff --git a/clang/tools/CIndex/CIndexer.h b/clang/tools/CIndex/CIndexer.h index 4f3cd8b85f71..1a4e4b7b8f0b 100644 --- a/clang/tools/CIndex/CIndexer.h +++ b/clang/tools/CIndex/CIndexer.h @@ -16,10 +16,6 @@ #define LLVM_CLANG_CINDEXER_H #include "clang-c/Index.h" -#include "clang/Index/ASTLocation.h" -#include "clang/Index/Indexer.h" -#include "clang/Index/Program.h" -#include "clang/Index/Utils.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/ASTUnit.h" #include "llvm/System/Path.h" @@ -34,7 +30,7 @@ public: virtual void HandleDiagnostic(Diagnostic::Level, const DiagnosticInfo &) {} }; -class CIndexer : public Indexer { +class CIndexer { DiagnosticOptions DiagOpts; IgnoreDiagnosticsClient IgnoreDiagClient; llvm::OwningPtr TextDiags; @@ -46,16 +42,12 @@ class CIndexer : public Indexer { llvm::sys::Path ClangPath; public: - explicit CIndexer(Program *prog) : Indexer(*prog), - IgnoreDiags(&IgnoreDiagClient), - UseExternalASTGeneration(false), - OnlyLocalDecls(false), - DisplayDiagnostics(false) { + CIndexer() : IgnoreDiags(&IgnoreDiagClient), UseExternalASTGeneration(false), + OnlyLocalDecls(false), DisplayDiagnostics(false) + { TextDiags.reset(CompilerInstance::createDiagnostics(DiagOpts, 0, 0)); } - virtual ~CIndexer() { delete &getProgram(); } - /// \brief Whether we only want to see "local" declarations (that did not /// come from a previous precompiled header). If false, we want to see all /// declarations. diff --git a/clang/tools/CIndex/CMakeLists.txt b/clang/tools/CIndex/CMakeLists.txt index c667df622f76..730eaafb5a2e 100644 --- a/clang/tools/CIndex/CMakeLists.txt +++ b/clang/tools/CIndex/CMakeLists.txt @@ -3,8 +3,7 @@ set(SHARED_LIBRARY TRUE) set(LLVM_NO_RTTI 1) set(LLVM_USED_LIBS - clangIndex - clangFrontend + clangFrontend clangDriver clangSema clangAnalysis diff --git a/clang/tools/CIndex/Makefile b/clang/tools/CIndex/Makefile index 94f04670000d..7bdbba172f2c 100644 --- a/clang/tools/CIndex/Makefile +++ b/clang/tools/CIndex/Makefile @@ -22,7 +22,7 @@ LINK_LIBS_IN_SHARED = 1 SHARED_LIBRARY = 1 LINK_COMPONENTS := bitreader mc core -USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \ +USEDLIBS = clangFrontend.a clangDriver.a clangSema.a \ clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a include $(LEVEL)/Makefile.common