diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-07-13 20:35:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2016-07-13 20:35:26 +0000 |
commit | dc0545b300c137ece52da033095c277b6cd81467 (patch) | |
tree | 10221e462c30e4bd054a3e42a4b05aa89bc6c01a /test/PCH | |
parent | ba772321020183f28e94acb3aa84724dbc31041f (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r-- | test/PCH/chain-invalid-code.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/PCH/chain-invalid-code.cpp b/test/PCH/chain-invalid-code.cpp new file mode 100644 index 0000000000..9de88f0cee --- /dev/null +++ b/test/PCH/chain-invalid-code.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only %s -chain-include %s -Wuninitialized -Wunused -verify + +// Make sure there is no crash. + +#ifndef HEADER +#define HEADER + +#include "non-existent-header.h" + +class A { +public: + ~A(); +}; + +class ForwardCls; +struct B { + ForwardCls f; + A a; +}; + +#else + +static void test() { + int x; // expected-warning {{unused}} + B b; +} + +#endif |