summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-21 03:03:22 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-21 03:03:22 +0000
commita39075952caea0af902f174ce26ad5ac787b3974 (patch)
treedb0e6aa5603bd2b1a1f96149da2a8c3671eba5c1 /tools
parentd553f8c57fc77a46f6a1a1c90d7fd8f2d0e96073 (diff)
downloadclang-a39075952caea0af902f174ce26ad5ac787b3974.tar.gz
Add Diagnostic to Indexer, and have it keep its own FileManager instead of taking an external reference (which was leaked in the case of the CIndex library).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82429 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/CIndex/CIndex.cpp3
-rw-r--r--tools/index-test/index-test.cpp11
2 files changed, 7 insertions, 7 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index b2fca60a6f..55bcd9330a 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -187,7 +187,8 @@ extern "C" {
CXIndex clang_createIndex()
{
- return new Indexer(*new Program(), *new FileManager());
+ // FIXME: Program is leaked.
+ return new Indexer(*new Program());
}
void clang_disposeIndex(CXIndex CIdx)
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index 2010434b7b..a0546bfcd8 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -211,10 +211,8 @@ int main(int argc, char **argv) {
llvm::cl::ParseCommandLineOptions(argc, argv,
"LLVM 'Clang' Indexing Test Bed: http://clang.llvm.org\n");
- FileManager FileMgr;
-
Program Prog;
- Indexer Idxer(Prog, FileMgr);
+ Indexer Idxer(Prog);
llvm::SmallVector<TUnit*, 4> TUnits;
// If no input was specified, read from stdin.
@@ -227,7 +225,8 @@ int main(int argc, char **argv) {
std::string ErrMsg;
llvm::OwningPtr<ASTUnit> AST;
- AST.reset(ASTUnit::LoadFromPCHFile(InFile, FileMgr, &ErrMsg));
+ AST.reset(ASTUnit::LoadFromPCHFile(InFile, Idxer.getFileManager(),
+ &ErrMsg));
if (!AST) {
llvm::errs() << "[" << InFile << "] Error: " << ErrMsg << '\n';
return 1;
@@ -245,7 +244,7 @@ int main(int argc, char **argv) {
if (!PointAtLocation.empty()) {
const std::string &Filename = PointAtLocation[0].FileName;
- const FileEntry *File = FileMgr.getFile(Filename);
+ const FileEntry *File = Idxer.getFileManager().getFile(Filename);
if (File == 0) {
llvm::errs() << "File '" << Filename << "' does not exist\n";
return 1;
@@ -254,7 +253,7 @@ int main(int argc, char **argv) {
// Safety check. Using an out-of-date AST file will only lead to crashes
// or incorrect results.
// FIXME: Check all the source files that make up the AST file.
- const FileEntry *ASTFile = FileMgr.getFile(FirstFile);
+ const FileEntry *ASTFile = Idxer.getFileManager().getFile(FirstFile);
if (File->getModificationTime() > ASTFile->getModificationTime()) {
llvm::errs() << "[" << FirstFile << "] Error: " <<
"Pointing at a source file which was modified after creating "