summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/pch-warn-as-error-code-split.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Index/pch-warn-as-error-code-split.cpp')
-rw-r--r--clang/test/Index/pch-warn-as-error-code-split.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Index/pch-warn-as-error-code-split.cpp b/clang/test/Index/pch-warn-as-error-code-split.cpp
new file mode 100644
index 00000000000..115c9e3d317
--- /dev/null
+++ b/clang/test/Index/pch-warn-as-error-code-split.cpp
@@ -0,0 +1,17 @@
+// RUN: CINDEXTEST_EDITING=1 c-index-test -test-load-source local %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=DIAGS %s
+
+// Make sure -Wuninitialized works even though the header had a warn-as-error occurrence.
+
+// DIAGS: error: unused variable 'x'
+// DIAGS: warning: variable 'x1' is uninitialized
+// DIAGS-NOT: error: use of undeclared identifier
+// DIAGS: warning: variable 'x1' is uninitialized
+
+#include "pch-warn-as-error-code-split.h"
+
+void test() {
+ int x1; // expected-note {{initialize}}
+ int x2 = x1; // expected-warning {{uninitialized}}
+ (void)x2;
+ foo_head();
+}
OpenPOWER on IntegriCloud