diff options
Diffstat (limited to 'test/Misc/serialized-diags-driver.c')
-rw-r--r-- | test/Misc/serialized-diags-driver.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Misc/serialized-diags-driver.c b/test/Misc/serialized-diags-driver.c new file mode 100644 index 0000000000000..ad07d666c8c12 --- /dev/null +++ b/test/Misc/serialized-diags-driver.c @@ -0,0 +1,20 @@ +// Test that the driver correctly combines its own diagnostics with CC1's in the +// serialized diagnostics. To test this, we need to trigger diagnostics from +// both processes, so we compile code that has a warning (with an associated +// note) and then force the driver to crash. We compile stdin so that the crash +// doesn't litter the user's system with preprocessed output. + +// RUN: rm -f %t +// RUN: %clang -Wx-unknown-warning -Wall -fsyntax-only --serialize-diagnostics %t.diag %s +// RUN: c-index-test -read-diagnostics %t.diag 2>&1 | FileCheck %s + +// CHECK: warning: unknown warning option '-Wx-unknown-warning' [-Wunknown-warning-option] [] + +// CHECK: warning: variable 'voodoo' is uninitialized when used here [-Wuninitialized] +// CHECK: note: initialize the variable 'voodoo' to silence this warning [] +// CHECK: Number of diagnostics: 2 + +void foo() { + int voodoo; + voodoo = voodoo + 1; +} |