• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -w -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-layout-nameless-struct-union.layout %s | FileCheck %s
2 
3 // CHECK: Type: struct S
4 // CHECK:   Size:64
5 // CHECK:   Alignment:32
6 // CHECK:   FieldOffsets: [0, 32, 32]
7 struct S {
8   short _s;
9 //union {
10     int _su0;
11     char _su1;
12 //};
13 };
14 
15 // CHECK: Type: union U
16 // CHECK:   Size:96
17 // CHECK:   Alignment:32
18 // CHECK:   FieldOffsets: [0, 0, 32, 64, 68, 73]
19 union U {
20   short _u;
21 //struct {
22     char _us0;
23     int _us1;
24     unsigned _us20 : 4;
25     unsigned _us21 : 5;
26     unsigned _us22 : 6;
27 //};
28 };
29 
use_structs()30 void use_structs() {
31   S ss[sizeof(S)];
32   U us[sizeof(U)];
33 }
34