// 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
// 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);
Out2 << " -load=" << FullLibraryPath.str() << " \\\n";
}
Out2 << " " << BitcodeOutputFilename << " ${1+\"$@\"}\n";
+ Out2.keep();
}
// BuildLinkItems -- This function generates a LinkItemList for the LinkItems