]> granicus.if.org Git - clang/commitdiff
Avoid calling report_fatal_error in the destructor of raw_fd_ostream
authorAlex Lorenz <arphaman@gmail.com>
Fri, 2 Jun 2017 10:36:56 +0000 (10:36 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Fri, 2 Jun 2017 10:36:56 +0000 (10:36 +0000)
when saving a module timestamp file

This commit doesn't include a test as it requires a test that reproduces
a file write/close error that couldn't really be constructed artificially.

rdar://31860650

Differential Revision: https://reviews.llvm.org/D33357

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

lib/Serialization/ASTReader.cpp

index 125b045351dae7086db577fe45a3b017cc7c0b99..e16a9b3ee3b5073cc335966fabf8889356cac665 100644 (file)
@@ -3697,6 +3697,8 @@ static void updateModuleTimestamp(ModuleFile &MF) {
   if (EC)
     return;
   OS << "Timestamp file\n";
+  OS.close();
+  OS.clear_error(); // Avoid triggering a fatal error.
 }
 
 /// \brief Given a cursor at the start of an AST file, scan ahead and drop the