150
|
1 // Check that clang can use a PCH created from libclang.
|
|
2
|
|
3 // This test doesn't use -fdisable-module-hash and hence requires that
|
|
4 // CompilerInvocation::getModuleHash() computes exactly the same hash
|
|
5 // for c-index-test and clang, which in turn requires that the both use
|
|
6 // exactly the same resource-dir, even without calling realpath() on it:
|
|
7 // - a/../b/ and b/ are not considered the same
|
|
8 // - on Windows, c:\ and C:\ (only different in case) are not the same
|
|
9
|
|
10 // RUN: rm -rf %t.mcp %t.h.pch
|
|
11 // RUN: %clang_cc1 -fsyntax-only %s -verify
|
|
12 // RUN: c-index-test -write-pch %t.h.pch %s -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin
|
|
13 // 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
|
|
14 // 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
|
|
15 // 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
|
|
16
|
|
17 // FIXME: Still fails on at least some linux boxen.
|
|
18 // REQUIRES: system-darwin
|
|
19
|
|
20 #ifndef HEADER
|
|
21 #define HEADER
|
|
22
|
|
23 void some_function(undeclared_type p); // expected-error{{unknown type name}}
|
|
24
|
|
25 struct S { int x; };
|
|
26
|
|
27 #else
|
|
28 // expected-no-diagnostics
|
|
29
|
|
30 void test(struct S *s) {
|
|
31 // CHECK: [[@LINE+1]]:6: MemberRefExpr=x:[[@LINE-6]]:16
|
|
32 s->x = 0;
|
|
33 }
|
|
34
|
|
35 #endif
|