[PATCH] D51836: [bugpoint] Revert r318459

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 11:44:47 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342503: [bugpoint] Revert r318459 (authored by dhinton, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D51836

Files:
  llvm/trunk/tools/bugpoint/ExecutionDriver.cpp


Index: llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
===================================================================
--- llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
+++ llvm/trunk/tools/bugpoint/ExecutionDriver.cpp
@@ -299,26 +299,32 @@
   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-%%%%%%%";
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51836.166011.patch
Type: text/x-patch
Size: 1662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180918/f373688a/attachment.bin>


More information about the llvm-commits mailing list