]> granicus.if.org Git - clang/commitdiff
Driver: Add list of temporary and result files to Compilation.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 17 Mar 2009 17:51:56 +0000 (17:51 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 17 Mar 2009 17:51:56 +0000 (17:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67087 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/Compilation.h

index 9dc1bcc2c10f85ac309f9e5ebad4e3167d001c9d..45813867690c1d41d2f347185637ef87eff84821 100644 (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;