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