[llvm] r212902 - bugpoint/ToolRunner.cpp: ProcessFailure(): Close ErrorFD immediately, or it couldn't be reopened on Win32.

NAKAMURA Takumi geek4civic at gmail.com
Wed Jul 23 15:13:21 PDT 2014


Then I didn't want to introduce weird #ifdef and #include there.
If we had an option "Don't use FD", entire the tweak could be useless,
I thought.

FYI, ::close(ErrorFD) can be not specific for Win32, but generic among
hosts there.

2014-07-24 7:09 GMT+09:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:
> Why not just
>
> close(ErrorFD) ?
>
> On 13 July 2014 09:28, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
>> Author: chapuni
>> Date: Sun Jul 13 08:28:18 2014
>> New Revision: 212902
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=212902&view=rev
>> Log:
>> bugpoint/ToolRunner.cpp: ProcessFailure(): 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.
>>
>> Modified:
>>     llvm/trunk/tools/bugpoint/ToolRunner.cpp
>>
>> Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=212902&r1=212901&r2=212902&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
>> +++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Sun Jul 13 08:28:18 2014
>> @@ -148,6 +148,14 @@ static std::string ProcessFailure(String
>>      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 ?
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list