Sent from my iPhone
On Jan 24, 2013, at 12:26 AM, NAKAMURA Takumi <[email protected]> wrote: > 2013/1/24 Douglas Gregor <[email protected]>: >> 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; >> +} _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
