2017-02-26 02:14:35 +08:00
// Check that clang can use a PCH created from libclang.
2017-02-26 03:17:11 +08:00
// FIXME: Non-darwin bots fail. Would need investigation using -module-file-info to see what is the difference in modules generated from libclang vs the compiler invocation, in those systems.
// REQUIRES: system-darwin
2017-02-27 10:06:18 +08:00
// RUN: %clang_cc1 -fsyntax-only %s -verify
2017-02-26 02:55:32 +08:00
// RUN: c-index-test -write-pch %t.h.pch %s -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin
2017-02-27 10:06:18 +08:00
// RUN: %clang -fsyntax-only -include %t.h %s -Xclang -verify -fmodules -fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang -triple -Xclang x86_64-apple-darwin -Xclang -fallow-pch-with-compiler-errors
2017-02-26 02:14:35 +08:00
# ifndef HEADER
# define HEADER
struct S { int x ; } ;
2017-02-27 10:06:18 +08:00
void some_function ( undeclared_type p ) ; // expected-error{{unknown type name}}
2017-02-26 02:14:35 +08:00
# else
2017-02-27 10:06:18 +08:00
// expected-no-diagnostics
2017-02-26 02:14:35 +08:00
void test ( struct S * s ) {
s - > x = 0 ;
}
# endif