summaryrefslogtreecommitdiff
path: root/tools/llvm-ld/llvm-ld.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-16 23:04:20 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-16 23:04:20 +0000
commit5f76760c880e6d61c229d2058c5699b033caeae1 (patch)
tree0afc79386ae09a712ea3dbd7fc4208d20d422eb9 /tools/llvm-ld/llvm-ld.cpp
parent9ac141823d6180f8a49299c55ed8fc8b9a8310a3 (diff)
downloadllvm-5f76760c880e6d61c229d2058c5699b033caeae1.tar.gz
llvm-5f76760c880e6d61c229d2058c5699b033caeae1.tar.bz2
llvm-5f76760c880e6d61c229d2058c5699b033caeae1.tar.xz
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
Diffstat (limited to 'tools/llvm-ld/llvm-ld.cpp')
-rw-r--r--tools/llvm-ld/llvm-ld.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp
index ce8cd86285..de3ef43c40 100644
--- a/tools/llvm-ld/llvm-ld.cpp
+++ b/tools/llvm-ld/llvm-ld.cpp
@@ -448,10 +448,11 @@ int main(int argc, char **argv, char **envp) {
// 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 @@ int main(int argc, char **argv, char **envp) {
// 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 @@ int main(int argc, char **argv, char **envp) {
// 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);