Eliminate CIndex's dependency on the Clang Index library, since we

weren't actually using any of its facilities.

llvm-svn: 94210
This commit is contained in:
Douglas Gregor 2010-01-22 20:35:53 +00:00
parent 0a2754ed8a
commit 877524918a
5 changed files with 7 additions and 20 deletions

View File

@ -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)

View File

@ -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.
//===----------------------------------------------------------------------===//

View File

@ -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<Diagnostic> 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.

View File

@ -3,8 +3,7 @@ set(SHARED_LIBRARY TRUE)
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS
clangIndex
clangFrontend
clangFrontend
clangDriver
clangSema
clangAnalysis

View File

@ -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