diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-20 16:59:15 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-20 16:59:15 +0000 |
commit | 8525fe7155a34f9e3fad0ea1012542453e803153 (patch) | |
tree | 0e892b7149ebade5cee7d020dd1afca7fbc3a443 /llvm/tools/llvm-ld/llvm-ld.cpp | |
parent | e3b3464d4e525c4ba1ff07329bfc7d0e2cc4f684 (diff) | |
download | bcm5719-llvm-8525fe7155a34f9e3fad0ea1012542453e803153.tar.gz bcm5719-llvm-8525fe7155a34f9e3fad0ea1012542453e803153.zip |
Convert tools to use tool_output_file, and introduce error
checking to places which previously lacked it.
llvm-svn: 111651
Diffstat (limited to 'llvm/tools/llvm-ld/llvm-ld.cpp')
-rw-r--r-- | llvm/tools/llvm-ld/llvm-ld.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp index eeb784b9e02..e4b2ae5d673 100644 --- a/llvm/tools/llvm-ld/llvm-ld.cpp +++ b/llvm/tools/llvm-ld/llvm-ld.cpp @@ -236,13 +236,16 @@ void GenerateBitcode(Module* M, const std::string& FileName) { // Create the output file. std::string ErrorInfo; - raw_fd_ostream Out(FileName.c_str(), ErrorInfo, - raw_fd_ostream::F_Binary); - if (!ErrorInfo.empty()) + tool_output_file Out(FileName.c_str(), ErrorInfo, + raw_fd_ostream::F_Binary); + if (!ErrorInfo.empty()) { PrintAndExit(ErrorInfo, M); + return; + } // Write it out WriteBitcodeToFile(M, Out); + Out.keep(); } /// GenerateAssembly - generates a native assembly language source file from the @@ -425,7 +428,7 @@ static void EmitShellScript(char **argv, Module *M) { // Output the script to start the program... std::string ErrorInfo; - raw_fd_ostream Out2(OutputFilename.c_str(), ErrorInfo); + tool_output_file Out2(OutputFilename.c_str(), ErrorInfo); if (!ErrorInfo.empty()) PrintAndExit(ErrorInfo, M); @@ -466,6 +469,7 @@ static void EmitShellScript(char **argv, Module *M) { Out2 << " -load=" << FullLibraryPath.str() << " \\\n"; } Out2 << " " << BitcodeOutputFilename << " ${1+\"$@\"}\n"; + Out2.keep(); } // BuildLinkItems -- This function generates a LinkItemList for the LinkItems |