Driver: Add list of temporary and result files to Compilation.

llvm-svn: 67087
This commit is contained in:
Daniel Dunbar 2009-03-17 17:51:56 +00:00
parent 527e2b3f8c
commit 106c22b2bb
1 changed files with 22 additions and 2 deletions

View File

@ -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<const ToolChain*, ArgList*> TCArgs;
/// Temporary files which should be removed on exit.
llvm::SmallVector<const char*, 4> TempFiles;
/// Result files which should be removed on failure.
llvm::SmallVector<const char*, 4> 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;