diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-13 10:37:48 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-13 10:37:48 +0000 |
commit | a9204831639e31474b927681b97c46781b758a1a (patch) | |
tree | 9600fb39d8cb93008149954bea4e3329c7476c64 /lib/Frontend/CompilerInstance.cpp | |
parent | 84c639a1a8fa3d45e8106b0ec492cc0ded08fcd1 (diff) |
Add output file list to CompilerInstance, so that it can track them instead of
forcing all clients to do it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index ce7c54f398..a7c6d5b488 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -25,6 +25,7 @@ #include "clang/Sema/CodeCompleteConsumer.h" #include "llvm/LLVMContext.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/System/Path.h" using namespace clang; CompilerInstance::CompilerInstance(llvm::LLVMContext *_LLVMContext, @@ -243,3 +244,22 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP, else return new CIndexCodeCompleteConsumer(ShowMacros, OS); } + +// Output Files + +void CompilerInstance::addOutputFile(llvm::StringRef Path, + llvm::raw_ostream *OS) { + assert(OS && "Attempt to add empty stream to output list!"); + OutputFiles.push_back(std::make_pair(Path, OS)); +} + +void CompilerInstance::ClearOutputFiles(bool EraseFiles) { + for (std::list< std::pair<std::string, llvm::raw_ostream*> >::iterator + it = OutputFiles.begin(), ie = OutputFiles.end(); it != ie; ++it) { + delete it->second; + if (EraseFiles && !it->first.empty()) + llvm::sys::Path(it->first).eraseFromDisk(); + } + OutputFiles.clear(); +} + |