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