[Bugpoint] Close error log in ProcessFailure. Bugpoint had been failing to close
authorLang Hames <lhames@gmail.com>
Tue, 7 Oct 2014 21:47:23 +0000 (21:47 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 7 Oct 2014 21:47:23 +0000 (21:47 +0000)
this, and in some circumstances (e.g. reducing particularly large test-cases)
this was causing bugpoint to be killed for hitting open file-handle limits.

No test case: I was only able to trigger this with test cases taking upwards of
10 mins to run.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219244 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/ToolRunner.cpp

index a28b2856f1e9cf0683e95ab91ace29c52b6f936a..bdbcffbe926201fd14e8445485cb7b464bcd5571 100644 (file)
@@ -141,21 +141,13 @@ static std::string ProcessFailure(StringRef ProgPath, const char** Args,
 
   // Rerun the compiler, capturing any error messages to print them.
   SmallString<128> ErrorFilename;
 
   // Rerun the compiler, capturing any error messages to print them.
   SmallString<128> ErrorFilename;
-  int ErrorFD;
   std::error_code EC = sys::fs::createTemporaryFile(
   std::error_code EC = sys::fs::createTemporaryFile(
-      "bugpoint.program_error_messages", "", ErrorFD, ErrorFilename);
+      "bugpoint.program_error_messages", "", ErrorFilename);
   if (EC) {
     errs() << "Error making unique filename: " << EC.message() << "\n";
     exit(1);
   }
 
   if (EC) {
     errs() << "Error making unique filename: " << EC.message() << "\n";
     exit(1);
   }
 
-#ifdef _WIN32
-  // Close ErrorFD immediately, or it couldn't be reopened on Win32.
-  // FIXME: We may have an option in openFileForWrite(), not to use ResultFD
-  // but to close it.
-  delete new raw_fd_ostream(ErrorFD, true);
-#endif
-
   RunProgramWithTimeout(ProgPath, Args, "", ErrorFilename.str(),
                         ErrorFilename.str(), Timeout, MemoryLimit);
   // FIXME: check return code ?
   RunProgramWithTimeout(ProgPath, Args, "", ErrorFilename.str(),
                         ErrorFilename.str(), Timeout, MemoryLimit);
   // FIXME: check return code ?