Files
clang-p2996/clang/test/Index/pch-warn-as-error-code-split.cpp
Argyrios Kyrtzidis 70ec1c7e62 [PCH/preamble] Make sure that if the preamble/PCH was serialized with errors that we set diagnostic engine state appropriately.
Otherwise there can be a crash with CFG analysis warnings doing work on invalid AST.

Fixes crash of rdar://26224134

llvm-svn: 275313
2016-07-13 20:35:26 +00:00

18 lines
600 B
C++

// 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();
}