2012-03-07 09:51:17 +08:00
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
2012-03-08 09:08:28 +08:00
|
|
|
#include "blahblah.h"
|
2012-03-07 09:51:17 +08:00
|
|
|
void erroneous(int);
|
|
|
|
void erroneous(float);
|
|
|
|
|
2012-03-10 04:10:30 +08:00
|
|
|
struct bar;
|
|
|
|
struct zed {
|
|
|
|
bar g;
|
|
|
|
};
|
|
|
|
struct baz {
|
|
|
|
zed h;
|
|
|
|
};
|
|
|
|
|
2012-03-10 05:09:04 +08:00
|
|
|
void errparm(zed e);
|
|
|
|
|
2012-03-10 04:10:30 +08:00
|
|
|
struct S {
|
|
|
|
{
|
|
|
|
;
|
|
|
|
|
2012-03-07 09:51:17 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
void foo(void) {
|
|
|
|
erroneous(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-03-08 09:08:28 +08:00
|
|
|
// RUN: c-index-test -write-pch %t.h.pch %s -Xclang -detailed-preprocessing-record
|
|
|
|
// RUN: c-index-test -test-load-source local %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-PARSE %s
|
|
|
|
// RUN: c-index-test -index-file %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s
|
2012-03-07 09:51:17 +08:00
|
|
|
|
2012-03-10 04:10:30 +08:00
|
|
|
// CHECK-PARSE: pch-with-errors.c:{{.*}}:6: FunctionDecl=foo
|
|
|
|
// CHECK-PARSE: pch-with-errors.c:{{.*}}:3: CallExpr=erroneous
|
2012-03-07 09:51:17 +08:00
|
|
|
|
|
|
|
// CHECK-INDEX: [indexDeclaration]: kind: function | name: foo
|
|
|
|
// CHECK-INDEX: [indexEntityReference]: kind: function | name: erroneous
|
|
|
|
|
2013-07-05 00:16:58 +08:00
|
|
|
// RUN: not %clang -fsyntax-only %s -include %t.h 2>&1 | FileCheck -check-prefix=PCH-ERR %s
|
2012-03-07 09:51:17 +08:00
|
|
|
// PCH-ERR: error: PCH file contains compiler errors
|
2012-06-08 13:48:06 +08:00
|
|
|
|
2013-07-05 00:16:58 +08:00
|
|
|
// RUN: not c-index-test -write-pch %t.pch foobar.c 2>&1 | FileCheck -check-prefix=NONEXISTENT %s
|
2012-06-08 13:48:06 +08:00
|
|
|
// NONEXISTENT: Unable to load translation unit
|