[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Index / pch-with-errors.c
blobe8711c8e26a9bc0dbe5fa1cb983fa6725d801039
1 #ifndef HEADER
2 #define HEADER
4 #include "blahblah.h"
5 void erroneous(int);
6 void erroneous(float);
8 struct bar;
9 struct zed {
10 bar g;
12 struct baz {
13 zed h;
16 void errparm(zed e);
18 struct S {
22 #else
24 void foo(void) {
25 erroneous(0);
28 #endif
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
34 // CHECK-PARSE: pch-with-errors.c:{{.*}}:6: FunctionDecl=foo
35 // CHECK-PARSE: pch-with-errors.c:{{.*}}:3: CallExpr=erroneous
37 // CHECK-INDEX: [indexDeclaration]: kind: function | name: foo
38 // CHECK-INDEX: [indexEntityReference]: kind: function | name: erroneous
40 // RUN: not %clang -fsyntax-only %s -include %t.h 2>&1 | FileCheck -check-prefix=PCH-ERR %s
41 // PCH-ERR: error: PCH file contains compiler errors
43 // RUN: not c-index-test -write-pch %t.pch foobar.c 2>&1 | FileCheck -check-prefix=NONEXISTENT %s
44 // NONEXISTENT: Unable to load translation unit
46 // RUN: %clang -x c-header %s -o %t-clang.h.pch -Xclang -detailed-preprocessing-record -Xclang -fallow-pch-with-compiler-errors
47 // RUN: c-index-test -index-file %s -include %t-clang.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s