blob: afdcb8a39a068ae1141effdd62e9d04849361f6d [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 < %s -emit-llvm > %t1 -triple=i686-apple-darwin9
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00002// RUN: grep "STest1 = type { i32, \[4 x i16\], double }" %t1
3// RUN: grep "STest2 = type { i16, i16, i32, i32 }" %t1
4// RUN: grep "STest3 = type { i8, i16, i32 }" %t1
5// RUN: grep "STestB1 = type { i8, i8 }" %t1
6// RUN: grep "STestB2 = type { i8, i8, i8 }" %t1
7// RUN: grep "STestB3 = type { i8, i8 }" %t1
8// RUN: grep "STestB4 = type { i8, i8, i8, i8 }" %t1
9// RUN: grep "STestB5 = type { i8, i8, \[2 x i8\], i8, i8 }" %t1
Anders Carlssonabdad352009-07-27 15:31:55 +000010// RUN: grep "STestB6 = type { i8, i8, \[2 x i8\] }" %t1
Devang Patel9544ff22007-10-31 21:02:10 +000011// Test struct layout for x86-darwin target
Devang Patel9544ff22007-10-31 21:02:10 +000012
13struct STest1 {int x; short y[4]; double z; } st1;
Devang Patelf9fef922007-11-01 00:07:12 +000014struct STest2 {short a,b; int c,d; } st2;
15struct STest3 {char a; short b; int c; } st3;
16
Devang Patel37884b32007-12-06 19:16:05 +000017// Bitfields
18struct STestB1 {char a; char b:2; } stb1;
Devang Patel6e8df732007-12-11 00:49:18 +000019struct STestB2 {char a; char b:5; char c:4; } stb2;
20struct STestB3 {char a; char b:2; } stb3;
21struct STestB4 {char a; short b:2; char c; } stb4;
Lauro Ramos Venancio2c46ce82008-01-21 22:54:57 +000022struct STestB5 {char a; short b:10; char c; } stb5;
23struct STestB6 {int a:1; char b; int c:13 } stb6;
Devang Patel37884b32007-12-06 19:16:05 +000024
Devang Patelf9fef922007-11-01 00:07:12 +000025// Packed struct STestP1 {char a; short b; int c; } __attribute__((__packed__)) stp1;