lib/Support/raw_ostream.cpp: On mingw, report_fatal_error() should not be called...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 16 Mar 2011 02:53:39 +0000 (02:53 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 16 Mar 2011 02:53:39 +0000 (02:53 +0000)
report_fatal_error() invokes exit(). We know report_fatal_error() might not write messages to stderr when any errors were detected on FD == 2.

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

lib/Support/raw_ostream.cpp

index b175d203a180e8ab1c9cafcea186b86680b005ad..a2ca101c558a14411ae2ee3a84b0f4c7348e8118 100644 (file)
@@ -466,6 +466,14 @@ raw_fd_ostream::~raw_fd_ostream() {
         }
   }
 
+#ifdef __MINGW32__
+  // On mingw, global dtors should not call exit().
+  // report_fatal_error() invokes exit(). We know report_fatal_error()
+  // might not write messages to stderr when any errors were detected
+  // on FD == 2.
+  if (FD == 2) return;
+#endif
+
   // If there are any pending errors, report them now. Clients wishing
   // to avoid report_fatal_error calls should check for errors with
   // has_error() and clear the error flag with clear_error() before