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 | 566eeb2da5cc531134811f471a23c6604ba48363 (patch) | |
tree | 9355b670a91f859f86a2284d1e0d7cddded47420 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | ac28c38737d43e085d620342f9fcb68867fb0610 (diff) | |
download | bcm5719-llvm-566eeb2da5cc531134811f471a23c6604ba48363.tar.gz bcm5719-llvm-566eeb2da5cc531134811f471a23c6604ba48363.zip |
Add output file list to CompilerInstance, so that it can track them instead of
forcing all clients to do it.
llvm-svn: 87103
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index ce7c54f3986..a7c6d5b4889 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/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(); +} + |