From: Daniel Dunbar Date: Tue, 17 Mar 2009 17:51:56 +0000 (+0000) Subject: Driver: Add list of temporary and result files to Compilation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df78a9515c108677ed42c2b982c612362f18c277;p=clang Driver: Add list of temporary and result files to Compilation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67087 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Compilation.h b/include/clang/Driver/Compilation.h index 9dc1bcc2c1..4581386769 100644 --- a/include/clang/Driver/Compilation.h +++ b/include/clang/Driver/Compilation.h @@ -13,6 +13,7 @@ #include "clang/Driver/Job.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" namespace clang { namespace driver { @@ -32,10 +33,15 @@ class Compilation { /// The root list of jobs. JobList Jobs; - /// TCArgs - Cache of translated arguments for a particular tool - /// chain. + /// Cache of translated arguments for a particular tool chain. llvm::DenseMap TCArgs; + /// Temporary files which should be removed on exit. + llvm::SmallVector TempFiles; + + /// Result files which should be removed on failure. + llvm::SmallVector ResultFiles; + public: Compilation(ToolChain &DefaultToolChain, ArgList *Args); ~Compilation(); @@ -48,6 +54,20 @@ public: /// chain, if TC is not specified). const ArgList &getArgsForToolChain(const ToolChain *TC = 0); + /// addTempFile - Add a file to remove on exit, and returns its + /// argument. + const char *addTempFile(const char *Name) { + TempFiles.push_back(Name); + return Name; + } + + /// addResultFile - Add a file to remove on failure, and returns its + /// argument. + const char *addResultFile(const char *Name) { + ResultFiles.push_back(Name); + return Name; + } + /// Execute - Execute the compilation jobs and return an /// appropriate exit code. int Execute() const;