For 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19001 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index 938648a..8f4dd3f 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -276,10 +276,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.
@@ -293,17 +294,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.
@@ -317,12 +320,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);