mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 06:10:48 +00:00
[bugpoint] Revert r318459
Summary: Revert r318459 which introduced a TempFile scoping bug. Differential Revision: https://reviews.llvm.org/D51836 llvm-svn: 342503
This commit is contained in:
parent
79e13b3973
commit
6c50f7113c
@ -299,26 +299,32 @@ Expected<std::string> BugDriver::executeProgram(const Module &Program,
|
||||
if (!AI)
|
||||
AI = Interpreter;
|
||||
assert(AI && "Interpreter should have been created already!");
|
||||
bool CreatedBitcode = false;
|
||||
if (BitcodeFile.empty()) {
|
||||
// Emit the program to a bitcode file...
|
||||
auto File =
|
||||
sys::fs::TempFile::create(OutputPrefix + "-test-program-%%%%%%%.bc");
|
||||
if (!File) {
|
||||
errs() << ToolName
|
||||
<< ": Error making unique filename: " << toString(File.takeError())
|
||||
SmallString<128> UniqueFilename;
|
||||
int UniqueFD;
|
||||
std::error_code EC = sys::fs::createUniqueFile(
|
||||
OutputPrefix + "-test-program-%%%%%%%.bc", UniqueFD, UniqueFilename);
|
||||
if (EC) {
|
||||
errs() << ToolName << ": Error making unique filename: " << EC.message()
|
||||
<< "!\n";
|
||||
exit(1);
|
||||
}
|
||||
DiscardTemp Discard{*File};
|
||||
BitcodeFile = File->TmpName;
|
||||
BitcodeFile = UniqueFilename.str();
|
||||
|
||||
if (writeProgramToFile(File->FD, Program)) {
|
||||
if (writeProgramToFile(BitcodeFile, UniqueFD, Program)) {
|
||||
errs() << ToolName << ": Error emitting bitcode to file '" << BitcodeFile
|
||||
<< "'!\n";
|
||||
exit(1);
|
||||
}
|
||||
CreatedBitcode = true;
|
||||
}
|
||||
|
||||
// Remove the temporary bitcode file when we are done.
|
||||
std::string BitcodePath(BitcodeFile);
|
||||
FileRemover BitcodeFileRemover(BitcodePath, CreatedBitcode && !SaveTemps);
|
||||
|
||||
if (OutputFile.empty())
|
||||
OutputFile = OutputPrefix + "-execution-output-%%%%%%%";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user