aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index d9fb406e5f..5a71fa3d8c 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -496,6 +496,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