[llvm-commits] CVS: llvm/lib/Support/ToolRunner.cpp

Reid Spencer reid at x10sys.com
Tue Dec 14 17:52:07 PST 2004



Changes in directory llvm/lib/Support:

ToolRunner.cpp updated: 1.34 -> 1.35
---
Log message:

For PR351: http://llvm.cs.uiuc.edu/PR351 :
* Remove #inclusion of FileUtilities.h, not needed any more.
* Convert getUniqueFilename -> sys::Pat::makeUnique()


---
Diffs of the changes:  (+17 -8)

Index: llvm/lib/Support/ToolRunner.cpp
diff -u llvm/lib/Support/ToolRunner.cpp:1.34 llvm/lib/Support/ToolRunner.cpp:1.35
--- llvm/lib/Support/ToolRunner.cpp:1.34	Mon Dec 13 17:43:44 2004
+++ llvm/lib/Support/ToolRunner.cpp	Tue Dec 14 19:51:56 2004
@@ -30,7 +30,8 @@
   OS << "\n";
 
   // Rerun the compiler, capturing any error messages to print them.
-  std::string ErrorFilename = getUniqueFilename("error_messages");
+  sys::Path ErrorFilename("error_messages");
+  ErrorFilename.makeUnique();
   RunProgramWithTimeout(ProgPath, Args, "/dev/null", ErrorFilename.c_str(),
                         ErrorFilename.c_str());
 
@@ -43,7 +44,7 @@
     ErrorFile.close();
   }
 
-  removeFile(ErrorFilename);
+  removeFile(ErrorFilename.toString());
   throw ToolExecutionError(OS.str());
 }
 
@@ -123,7 +124,9 @@
 // LLC Implementation of AbstractIntepreter interface
 //
 void LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) {
-  OutputAsmFile = getUniqueFilename(Bytecode+".llc.s");
+  sys::Path uniqueFile(Bytecode+".llc.s");
+  uniqueFile.makeUnique();
+  OutputAsmFile = uniqueFile.toString();
   std::vector<const char *> LLCArgs;
   LLCArgs.push_back (LLCPath.c_str());
 
@@ -265,7 +268,9 @@
 
 void CBE::OutputC(const std::string &Bytecode,
                  std::string &OutputCFile) {
-  OutputCFile = getUniqueFilename(Bytecode+".cbe.c");
+  sys::Path uniqueFile(Bytecode+".cbe.c");
+  uniqueFile.makeUnique();
+  OutputCFile = uniqueFile.toString();
   std::vector<const char *> LLCArgs;
   LLCArgs.push_back (LLCPath.c_str());
 
@@ -361,7 +366,8 @@
   }
   GCCArgs.push_back(ProgramFile.c_str());  // Specify the input filename...
   GCCArgs.push_back("-o");
-  std::string OutputBinary = getUniqueFilename(ProgramFile+".gcc.exe");
+  sys::Path OutputBinary (ProgramFile+".gcc.exe");
+  OutputBinary.makeUnique();
   GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
   GCCArgs.push_back("-lm");                // Hard-code the math library...
   GCCArgs.push_back("-O2");                // Optimize the program a bit...
@@ -392,14 +398,17 @@
         std::cerr << "\n";
         );
 
-  FileRemover OutputBinaryRemover(OutputBinary);
-  return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
+  FileRemover OutputBinaryRemover(OutputBinary.toString());
+  return RunProgramWithTimeout(OutputBinary.toString(), &ProgramArgs[0],
                                InputFile, OutputFile, OutputFile, Timeout);
 }
 
 int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
                           std::string &OutputFile) {
-  OutputFile = getUniqueFilename(InputFile+LTDL_SHLIB_EXT);
+  sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
+  uniqueFilename.makeUnique();
+  OutputFile = uniqueFilename.toString();
+
   // Compile the C/asm file into a shared object
   const char* GCCArgs[] = {
     GCCPath.c_str(),






More information about the llvm-commits mailing list