]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Index/pch-from-libclang.c
Vendor import of clang trunk r300422:
[FreeBSD/FreeBSD.git] / test / Index / pch-from-libclang.c
1 // Check that clang can use a PCH created from libclang.
2
3 // 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.
4 // REQUIRES: system-darwin
5
6 // RUN: %clang_cc1 -fsyntax-only %s -verify
7 // RUN: c-index-test -write-pch %t.h.pch %s -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin
8 // 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
9 // RUN: %clang -x c-header %s -o %t.clang.h.pch -fmodules -fmodules-cache-path=%t.mcp -Xclang -detailed-preprocessing-record -Xclang -triple -Xclang x86_64-apple-darwin -Xclang -fallow-pch-with-compiler-errors -Xclang -verify
10 // RUN: c-index-test -test-load-source local %s -include %t.clang.h -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin | FileCheck %s
11
12 #ifndef HEADER
13 #define HEADER
14
15 void some_function(undeclared_type p); // expected-error{{unknown type name}}
16
17 struct S { int x; };
18
19 #else
20 // expected-no-diagnostics
21
22 void test(struct S *s) {
23   // CHECK: [[@LINE+1]]:6: MemberRefExpr=x:[[@LINE-6]]:16
24   s->x = 0;
25 }
26
27 #endif