• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/struct1.c
2 // RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/struct2.c
3 // RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
4 
5 // CHECK: struct1.c:13:8: warning: type 'struct S1' has incompatible definitions in different translation units
6 // CHECK: struct1.c:15:7: note: field 'field2' has type 'int' here
7 // CHECK: struct2.c:12:9: note: field 'field2' has type 'float' here
8 // CHECK: struct2.c:15:11: warning: external variable 'x1' declared with incompatible types in different translation units ('struct S1' vs. 'struct S1')
9 // CHECK: struct1.c:18:11: note: declared here with type 'struct S1'
10 // CHECK: struct1.c:21:8: warning: type 'struct S2' has incompatible definitions in different translation units
11 // CHECK: struct2.c:18:7: note: 'S2' is a union here
12 // CHECK: struct2.c:18:30: warning: external variable 'x2' declared with incompatible types in different translation units ('union S2' vs. 'struct S2')
13 // CHECK: struct1.c:21:31: note: declared here with type 'struct S2'
14 // CHECK: struct1.c:24:8: warning: type 'struct S3' has incompatible definitions in different translation units
15 // CHECK: struct1.c:24:36: note: field 'd' has type 'double' here
16 // CHECK: struct2.c:21:8: note: no corresponding field here
17 // CHECK: struct2.c:21:31: warning: external variable 'x3' declared with incompatible types in different translation units ('struct S3' vs. 'struct S3')
18 // CHECK: struct1.c:24:41: note: declared here with type 'struct S3'
19 // CHECK: struct1.c:27:8: warning: type 'struct S4' has incompatible definitions in different translation units
20 // CHECK: struct2.c:24:26: note: field 'f' has type 'float' here
21 // CHECK: struct1.c:27:8: note: no corresponding field here
22 // CHECK: struct2.c:24:31: warning: external variable 'x4' declared with incompatible types in different translation units ('struct S4' vs. 'struct S4')
23 // CHECK: struct1.c:27:22: note: declared here with type 'struct S4'
24 // CHECK: struct1.c:56:10: warning: type 'struct DeeperError' has incompatible definitions in different translation units
25 // CHECK: struct1.c:56:35: note: field 'f' has type 'int' here
26 // CHECK: struct2.c:53:37: note: field 'f' has type 'float' here
27 // CHECK: struct1.c:54:8: warning: type 'struct DeepError' has incompatible definitions in different translation units
28 // CHECK: struct1.c:56:41: note: field 'Deeper' has type 'struct DeeperError *' here
29 // CHECK: struct2.c:53:43: note: field 'Deeper' has type 'struct DeeperError *' here
30 // CHECK: struct2.c:54:3: warning: external variable 'xDeep' declared with incompatible types in different translation units ('struct DeepError' vs. 'struct DeepError')
31 // CHECK: struct1.c:57:3: note: declared here with type 'struct DeepError'
32 // CHECK: struct1.c:74:9: warning: type 'S13' has incompatible definitions in different translation units
33 // CHECK: struct1.c:75:9: note: field 'i' has type 'Float' (aka 'float') here
34 // CHECK: struct2.c:72:7: note: field 'i' has type 'int' here
35 // CHECK: struct2.c:76:5: warning: external variable 'x13' declared with incompatible types in different translation units ('S13' vs. 'S13')
36 // CHECK: struct1.c:79:5: note: declared here with type 'S13'
37 // CHECK: struct1.c:130:7: warning: type 'struct DeepUnnamedError::(anonymous at [[PATH_TO_INPUTS:.+]]struct1.c:130:7)' has incompatible definitions in different translation units
38 // CHECK: struct1.c:131:14: note: field 'i' has type 'long' here
39 // CHECK: struct2.c:128:15: note: field 'i' has type 'float' here
40 // CHECK: struct1.c:129:5: warning: type 'union DeepUnnamedError::(anonymous at [[PATH_TO_INPUTS]]struct1.c:129:5)' has incompatible definitions in different translation units
41 // CHECK: struct1.c:132:9: note: field 'S' has type 'struct (anonymous struct at [[PATH_TO_INPUTS]]struct1.c:130:7)' here
42 // CHECK: struct2.c:129:9: note: field 'S' has type 'struct (anonymous struct at [[PATH_TO_INPUTS]]struct2.c:127:7)' here
43 // CHECK: struct2.c:138:3: warning: external variable 'x16' declared with incompatible types in different translation units ('struct DeepUnnamedError' vs. 'struct DeepUnnamedError')
44 // CHECK: struct1.c:141:3: note: declared here with type 'struct DeepUnnamedError'
45 // CHECK: 17 warnings generated
46