xref: /minix3/external/bsd/llvm/dist/clang/test/ASTMerge/Inputs/struct2.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Matches
2*f4a2713aSLionel Sambuc struct S0 {
3*f4a2713aSLionel Sambuc   int field1;
4*f4a2713aSLionel Sambuc   float field2;
5*f4a2713aSLionel Sambuc };
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc struct S0 x0;
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc // Mismatch in field type
10*f4a2713aSLionel Sambuc struct S1 {
11*f4a2713aSLionel Sambuc   int field1;
12*f4a2713aSLionel Sambuc   float field2;
13*f4a2713aSLionel Sambuc };
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc struct S1 x1;
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // Mismatch in tag kind.
18*f4a2713aSLionel Sambuc union S2 { int i; float f; } x2;
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc // Missing fields
21*f4a2713aSLionel Sambuc struct S3 { int i; float f; } x3;
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc // Extra fields
24*f4a2713aSLionel Sambuc struct S4 { int i; float f; } x4;
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc // Bit-field matches
27*f4a2713aSLionel Sambuc struct S5 { int i : 8; unsigned j : 8; } x5;
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc // Bit-field mismatch
30*f4a2713aSLionel Sambuc struct S6 { int i : 8; unsigned j; } x6;
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc // Bit-field mismatch
33*f4a2713aSLionel Sambuc struct S7 { int i : 8; unsigned j : 16; } x7;
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc // Incomplete type
36*f4a2713aSLionel Sambuc struct S8 { int i; float f; } *x8;
37*f4a2713aSLionel Sambuc 
38*f4a2713aSLionel Sambuc // Incomplete type
39*f4a2713aSLionel Sambuc struct S9 *x9;
40*f4a2713aSLionel Sambuc 
41*f4a2713aSLionel Sambuc // Incomplete type
42*f4a2713aSLionel Sambuc struct S10 *x10;
43*f4a2713aSLionel Sambuc 
44*f4a2713aSLionel Sambuc // Matches
45*f4a2713aSLionel Sambuc struct ListNode {
46*f4a2713aSLionel Sambuc   int value;
47*f4a2713aSLionel Sambuc   struct ListNode *Next;
48*f4a2713aSLionel Sambuc } xList;
49*f4a2713aSLionel Sambuc 
50*f4a2713aSLionel Sambuc // Mismatch due to struct used internally
51*f4a2713aSLionel Sambuc struct DeepError {
52*f4a2713aSLionel Sambuc   int value;
53*f4a2713aSLionel Sambuc   struct DeeperError { int i; float f; } *Deeper;
54*f4a2713aSLionel Sambuc } xDeep;
55*f4a2713aSLionel Sambuc 
56*f4a2713aSLionel Sambuc // Matches
57*f4a2713aSLionel Sambuc struct {
58*f4a2713aSLionel Sambuc   int i;
59*f4a2713aSLionel Sambuc   float f;
60*f4a2713aSLionel Sambuc } x11;
61