[llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp

Reid Spencer reid at x10sys.com
Thu Dec 16 15:04:31 PST 2004



Changes in directory llvm/tools/llvm-ld:

llvm-ld.cpp updated: 1.12 -> 1.13
---
Log message:

For PR351: http://llvm.cs.uiuc.edu/PR351 :
* removeFile() -> sys::Path::destroyFile()
* remove extraneous toString() calls
* convert local variables representing path names from std::string to
  sys::Path
* Use sys::Path objects with FileRemove instead of std::string
* Use sys::Path methods for construction of path names 


---
Diffs of the changes:  (+13 -10)

Index: llvm/tools/llvm-ld/llvm-ld.cpp
diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.12 llvm/tools/llvm-ld/llvm-ld.cpp:1.13
--- llvm/tools/llvm-ld/llvm-ld.cpp:1.12	Mon Dec 13 22:20:08 2004
+++ llvm/tools/llvm-ld/llvm-ld.cpp	Thu Dec 16 17:04:20 2004
@@ -448,10 +448,11 @@
     // Otherwise, create a script that will run the bytecode through the JIT.
     if (Native) {
       // Name of the Assembly Language output file
-      std::string AssemblyFile = OutputFilename + ".s";
+      sys::Path AssemblyFile ( OutputFilename);
+      AssemblyFile.appendSuffix("s");
 
       // Mark the output files for removal if we get an interrupt.
-      sys::RemoveFileOnSignal(sys::Path(AssemblyFile));
+      sys::RemoveFileOnSignal(AssemblyFile);
       sys::RemoveFileOnSignal(sys::Path(OutputFilename));
 
       // Determine the locations of the llc and gcc programs.
@@ -465,17 +466,19 @@
 
       // Generate an assembly language file for the bytecode.
       if (Verbose) std::cout << "Generating Assembly Code\n";
-      GenerateAssembly(AssemblyFile, RealBytecodeOutput, llc);
+      GenerateAssembly(AssemblyFile.toString(), RealBytecodeOutput, llc);
       if (Verbose) std::cout << "Generating Native Code\n";
-      GenerateNative(OutputFilename, AssemblyFile, Libraries, gcc, envp);
+      GenerateNative(OutputFilename, AssemblyFile.toString(), Libraries, 
+                     gcc, envp);
 
       // Remove the assembly language file.
-      removeFile (AssemblyFile);
+      AssemblyFile.destroyFile();
     } else if (NativeCBE) {
-      std::string CFile = OutputFilename + ".cbe.c";
+      sys::Path CFile (OutputFilename);
+      CFile.appendSuffix("cbe.c");
 
       // Mark the output files for removal if we get an interrupt.
-      sys::RemoveFileOnSignal(sys::Path(CFile));
+      sys::RemoveFileOnSignal(CFile);
       sys::RemoveFileOnSignal(sys::Path(OutputFilename));
 
       // Determine the locations of the llc and gcc programs.
@@ -489,12 +492,12 @@
 
       // Generate an assembly language file for the bytecode.
       if (Verbose) std::cout << "Generating Assembly Code\n";
-      GenerateCFile(CFile, RealBytecodeOutput, llc);
+      GenerateCFile(CFile.toString(), RealBytecodeOutput, llc);
       if (Verbose) std::cout << "Generating Native Code\n";
-      GenerateNative(OutputFilename, CFile, Libraries, gcc, envp);
+      GenerateNative(OutputFilename, CFile.toString(), Libraries, gcc, envp);
 
       // Remove the assembly language file.
-      removeFile(CFile);
+      CFile.destroyFile();
 
     } else {
       EmitShellScript(argv);






More information about the llvm-commits mailing list