diff options
Diffstat (limited to 'test/CodeGen/override-layout.c')
-rw-r--r-- | test/CodeGen/override-layout.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/test/CodeGen/override-layout.c b/test/CodeGen/override-layout.c index 99c2cd6..57de8b5 100644 --- a/test/CodeGen/override-layout.c +++ b/test/CodeGen/override-layout.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -w -fdump-record-layouts %s 2> %t.layouts -// RUN: %clang_cc1 -w -fdump-record-layouts-simple %s > %t.before 2>&1 -// RUN: %clang_cc1 -w -DPACKED= -DALIGNED16= -fdump-record-layouts-simple -foverride-record-layout=%t.layouts %s > %t.after 2>&1 +// RUN: %clang_cc1 -w -fdump-record-layouts %s > %t.layouts +// RUN: %clang_cc1 -w -fdump-record-layouts-simple %s > %t.before +// RUN: %clang_cc1 -w -DPACKED= -DALIGNED16= -fdump-record-layouts-simple -foverride-record-layout=%t.layouts %s > %t.after // RUN: diff %t.before %t.after // RUN: FileCheck %s < %t.after @@ -19,24 +19,32 @@ struct X0 { int x[6] PACKED; }; +void use_X0() { struct X0 x0; x0.x[5] = sizeof(struct X0); }; + // CHECK: Type: struct X1 struct X1 { char x[13]; struct X0 y; } PACKED; +void use_X1() { struct X1 x1; x1.x[5] = sizeof(struct X1); }; + // CHECK: Type: struct X2 struct PACKED X2 { short x; int y; }; +void use_X2() { struct X2 x2; x2.y = sizeof(struct X2); }; + // CHECK: Type: struct X3 struct X3 { short x PACKED; int y; }; +void use_X3() { struct X3 x3; x3.y = sizeof(struct X3); }; + #pragma pack(push,2) // CHECK: Type: struct X4 struct X4 { @@ -45,18 +53,26 @@ struct X4 { }; #pragma pack(pop) +void use_X4() { struct X4 x4; x4.y = sizeof(struct X4); }; + // CHECK: Type: struct X5 struct PACKED X5 { double a[19]; signed char b; }; +void use_X5() { struct X5 x5; x5.b = sizeof(struct X5); }; + // CHECK: Type: struct X6 struct PACKED X6 { long double a; char b; }; +void use_X6() { struct X6 x6; x6.b = sizeof(struct X6); }; + // CHECK: Type: struct X7 struct X7 { unsigned x; unsigned char y; } PACKED; +void use_X7() { struct X7 x7; x7.y = x7.x = sizeof(struct X7); } + // CHECK: Type: union X8 union X8 { struct X7 x; @@ -114,32 +130,6 @@ struct ALIGNED16 X16 { }; void use_structs() { - struct X0 x0; - x0.x[5] = sizeof(struct X0); - - struct X1 x1; - x1.x[5] = sizeof(struct X1); - - struct X2 x2; - x2.y = sizeof(struct X2); - - struct X3 x3; - x3.y = sizeof(struct X3); - - struct X4 x4; - x4.y = sizeof(struct X4); - - struct X5 x5; - x5.b = sizeof(struct X5); - - struct X6 x6; - x6.b = sizeof(struct X6); - - struct X7 x7; - typedef int X7array[sizeof(struct X7)]; - x7.x = sizeof(struct X7); - x7.y = x7.x; - union X8 x8; typedef int X8array[sizeof(union X8)]; x8.y = sizeof(union X8); |