[libclang] When there's a file error when saving the PCH, make sure to

clear the error from raw_fd_ostream, otherwise we will crash.

rdar://10976410

llvm-svn: 152605
This commit is contained in:
Argyrios Kyrtzidis 2012-03-13 02:17:06 +00:00
parent 68fc21562f
commit eeea16a0d5
1 changed files with 3 additions and 1 deletions

View File

@ -2411,8 +2411,10 @@ CXSaveError ASTUnit::Save(StringRef File) {
serialize(Out);
Out.close();
if (Out.has_error())
if (Out.has_error()) {
Out.clear_error();
return CXSaveError_Unknown;
}
if (llvm::sys::fs::rename(TempPath.str(), File)) {
bool exists;