]> granicus.if.org Git - clang/commitdiff
Attempt to fix the MSVC9 failure with c-indext-test, where the CIndex DLL
authorDouglas Gregor <dgregor@apple.com>
Sun, 21 Feb 2010 20:15:42 +0000 (20:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 21 Feb 2010 20:15:42 +0000 (20:15 +0000)
and the c-index-test executable end up getting different copies of
stderr, causing non-deterministic ordering of output. Fixed by
flushing the file after printing a diagnostic (only on Windows).

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

test/Index/cindex-on-invalid.m
tools/CIndex/CIndexDiagnostic.cpp

index 626f566202ad6aefc3fdfcb5d85babcfea33b06f..7e190eb0794052e615c759802ef888692639e0fd 100644 (file)
@@ -1,6 +1,5 @@
 // RUN: not c-index-test -test-load-source local %s > %t 2> %t.err
 // RUN: FileCheck %s < %t.err
-// XFAIL: win32
 // CHECK: error: expected identifier or '('
 // CHECK: Unable to load translation unit!
 
index 97d5017077483ad1a02eb9b11c9717caecb83193..75da335afc2922828728e9d9d084aea9cb76a563 100644 (file)
@@ -116,6 +116,13 @@ void clang_displayDiagnostic(CXDiagnostic Diagnostic, FILE *Out,
   else
     fprintf(Out, "<no diagnostic text>\n");
   clang_disposeString(Text);
+
+#ifdef LLVM_ON_WIN32
+  // On Windows, force a flush, since there may be multiple copies of
+  // stderr and stdout in the file system, all with different buffers
+  // but writing to the same device.
+  fflush(Out);
+#endif
 }
 
 unsigned clang_defaultDiagnosticDisplayOptions() {