[cfe-commits] r173301 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/CompilerInstance.h include/clang/Frontend/FrontendOptions.h include/clang/Serialization/GlobalModuleIndex.h lib/Frontend/CompilerInstance.cpp lib/Frontend/CompilerInvocation.cpp lib/Frontend/FrontendAction.cpp lib/Serialization/ASTReader.cpp lib/Serialization/CMakeLists.txt lib/Serialization/GlobalModuleIndex.cpp test/Modules/global_index.m
Douglas Gregor
dgregor at apple.com
Thu Jan 24 10:27:44 PST 2013
Sent from my iPhone
On Jan 24, 2013, at 12:26 AM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> 2013/1/24 Douglas Gregor <dgregor at apple.com>:
>> Author: dgregor
>> Date: Wed Jan 23 16:38:11 2013
>> New Revision: 173301
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=173301&view=rev
>> Log:
>> Implement the writer side of the global module index.
>>
>> + // Open the temporary global index file for output.
>> + std::string ErrorInfo;
>> + llvm::raw_fd_ostream Out(IndexTmpPath.c_str(), ErrorInfo,
>> + llvm::raw_fd_ostream::F_Binary);
>
> 2nd open fails on win32, since TmpFD has been left opened.
> Tweaked in r173330.
Ah, good catch. Thanks!
>> + if (Out.has_error())
>> + return EC_IOError;
>> +
>> + // Write the index.
>> + Out.write(OutputBuffer.data(), OutputBuffer.size());
>> + Out.close();
>> + if (Out.has_error())
>> + return EC_IOError;
>> +
>> + // Remove the old index file. It isn't relevant any more.
>> + bool OldIndexExisted;
>> + llvm::sys::fs::remove(IndexPath.str(), OldIndexExisted);
>> +
>> + // Rename the newly-written index file to the proper name.
>> + if (llvm::sys::fs::rename(IndexTmpPath.str(), IndexPath.str())) {
>> + // Rename failed; just remove the
>> + llvm::sys::fs::remove(IndexTmpPath.str(), OldIndexExisted);
>> + return EC_IOError;
>> + }
>> +
>> + // We're done.
>> + return EC_None;
>> +}
More information about the cfe-commits
mailing list