[InstCombine] Preserve NSW flags for `lshr (mul nuw X, C1), C2 -> mul nuw nsw X,...
[llvm-project.git] / clang / test / CodeGenCXX / override-bit-field-layout.cpp
blobcdafc07c84ff0e562b5c1351f3bdb32369676d7c
1 // RUN: %clang_cc1 %std_cxx98-14 -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-bit-field-layout.layout %s | FileCheck %s --check-prefixes=CHECK,PRE17
2 // RUN: %clang_cc1 -std=c++17 -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-bit-field-layout.layout %s | FileCheck %s --check-prefixes=CHECK,CXX17
3 // RUN: %clang_cc1 %std_cxx20- -w -triple=x86_64-pc-win32 -fms-compatibility -fdump-record-layouts-simple -foverride-record-layout=%S/Inputs/override-bit-field-layout.layout %s | FileCheck %s --check-prefixes=CHECK,CXX20
5 // PRE17: Type: struct S1
6 // PRE17: FieldOffsets: [0, 11]
7 struct S1 {
8 short a : 3;
9 short b : 5;
12 // CHECK: Type: struct S2
13 // CHECK: FieldOffsets: [64]
14 struct S2 {
15 virtual ~S2() = default;
16 short a : 3;
19 // CXX17: Type: struct S1
20 // CXX17: FieldOffsets: [0, 11]
21 // CXX20: Type: struct S1
22 // CXX20: FieldOffsets: [0, 3]
24 // CHECK: Type: struct S3
25 // CHECK: Size:32
26 // CHECK: FieldOffsets: [0, 1]
27 struct S3 {
28 int a : 1;
29 int b : 2;
32 // CHECK: Type: struct S4
33 // CHECK: FieldOffsets: [32]
34 struct S4 : S3 {
35 char c;
38 void use_structs() {
39 S1 s1s[sizeof(S1)];
40 S2 s2s[sizeof(S2)];
41 S3 s3s[sizeof(S3)];
42 S4 s4s[sizeof(S4)];