Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Index / pch-warn-as-error-code.cpp
blob6a7924a09e631adb10f00688490916087f0a4dd8
1 // RUN: rm -f %t.head.h.pch
2 // RUN: c-index-test -write-pch %t.head.h.pch %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=HEAD_DIAGS %s
3 // RUN: c-index-test -test-load-source local %s -include %t.head.h -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=MAIN_DIAGS %s
5 // Make sure -Wuninitialized works even though the header had a warn-as-error occurrence.
7 // HEAD_DIAGS: error: unused variable 'x'
8 // MAIN_DIAGS: warning: variable 'x1' is uninitialized
9 // MAIN_DIAGS-NOT: error: use of undeclared identifier
11 #ifndef HEADER
12 #define HEADER
14 static void foo_head() {
15 int x;
18 #else
20 void test() {
21 int x1; // expected-note {{initialize}}
22 int x2 = x1; // expected-warning {{uninitialized}}
23 (void)x2;
24 foo_head();
27 #endif