diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-21 03:03:22 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-21 03:03:22 +0000 |
commit | 948062a592f9153dece886165e7c9365fa13715f (patch) | |
tree | 60a402bf8f07dc52ba99df33452b9031ca8a63c1 /clang/tools/index-test/index-test.cpp | |
parent | 9858859fd6854f3c68e41464ccc6f62e61c8b238 (diff) | |
download | bcm5719-llvm-948062a592f9153dece886165e7c9365fa13715f.tar.gz bcm5719-llvm-948062a592f9153dece886165e7c9365fa13715f.zip |
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).
llvm-svn: 82429
Diffstat (limited to 'clang/tools/index-test/index-test.cpp')
-rw-r--r-- | clang/tools/index-test/index-test.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/tools/index-test/index-test.cpp b/clang/tools/index-test/index-test.cpp index 2010434b7b5..a0546bfcd8e 100644 --- a/clang/tools/index-test/index-test.cpp +++ b/clang/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 " |