Argyrios Kyrtzidis | bef35c9 | 2012-03-07 01:51:17 +0000 | [diff] [blame] | 1 | #ifndef HEADER |
| 2 | #define HEADER |
| 3 | |
Argyrios Kyrtzidis | 29f98b4 | 2012-03-08 01:08:28 +0000 | [diff] [blame] | 4 | #include "blahblah.h" |
Argyrios Kyrtzidis | bef35c9 | 2012-03-07 01:51:17 +0000 | [diff] [blame] | 5 | void erroneous(int); |
| 6 | void erroneous(float); |
| 7 | |
Argyrios Kyrtzidis | 216f78b | 2012-03-09 20:10:30 +0000 | [diff] [blame] | 8 | struct bar; |
| 9 | struct zed { |
| 10 | bar g; |
| 11 | }; |
| 12 | struct baz { |
| 13 | zed h; |
| 14 | }; |
| 15 | |
Argyrios Kyrtzidis | ba50b3e | 2012-03-09 21:09:04 +0000 | [diff] [blame] | 16 | void errparm(zed e); |
| 17 | |
Argyrios Kyrtzidis | 216f78b | 2012-03-09 20:10:30 +0000 | [diff] [blame] | 18 | struct S { |
| 19 | { |
| 20 | ; |
| 21 | |
Argyrios Kyrtzidis | bef35c9 | 2012-03-07 01:51:17 +0000 | [diff] [blame] | 22 | #else |
| 23 | |
| 24 | void foo(void) { |
| 25 | erroneous(0); |
| 26 | } |
| 27 | |
| 28 | #endif |
| 29 | |
Argyrios Kyrtzidis | 29f98b4 | 2012-03-08 01:08:28 +0000 | [diff] [blame] | 30 | // RUN: c-index-test -write-pch %t.h.pch %s -Xclang -detailed-preprocessing-record |
| 31 | // RUN: c-index-test -test-load-source local %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-PARSE %s |
| 32 | // RUN: c-index-test -index-file %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s |
Argyrios Kyrtzidis | bef35c9 | 2012-03-07 01:51:17 +0000 | [diff] [blame] | 33 | |
Argyrios Kyrtzidis | 216f78b | 2012-03-09 20:10:30 +0000 | [diff] [blame] | 34 | // CHECK-PARSE: pch-with-errors.c:{{.*}}:6: FunctionDecl=foo |
| 35 | // CHECK-PARSE: pch-with-errors.c:{{.*}}:3: CallExpr=erroneous |
Argyrios Kyrtzidis | bef35c9 | 2012-03-07 01:51:17 +0000 | [diff] [blame] | 36 | |
| 37 | // CHECK-INDEX: [indexDeclaration]: kind: function | name: foo |
| 38 | // CHECK-INDEX: [indexEntityReference]: kind: function | name: erroneous |
| 39 | |
| 40 | // RUN: %clang -fsyntax-only %s -include %t.h 2>&1 | FileCheck -check-prefix=PCH-ERR %s |
Argyrios Kyrtzidis | bef35c9 | 2012-03-07 01:51:17 +0000 | [diff] [blame] | 41 | // PCH-ERR: error: PCH file contains compiler errors |
Argyrios Kyrtzidis | 374a00b | 2012-06-08 05:48:06 +0000 | [diff] [blame] | 42 | |
| 43 | // RUN: c-index-test -write-pch %t.pch foobar.c 2>&1 | FileCheck -check-prefix=NONEXISTENT %s |
| 44 | // NONEXISTENT: Unable to load translation unit |