Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions clang/lib/CIR/CodeGen/CIRGenRecordLayoutBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,11 +499,7 @@ void CIRRecordLowering::accumulateFields() {
fieldEnd = recordDecl->field_end();
field != fieldEnd;) {
if (field->isBitField()) {
RecordDecl::field_iterator start = field;
// Iterate to gather the list of bitfields.
for (++field; field != fieldEnd && field->isBitField(); ++field)
;
field = accumulateBitFields(start, field);
field = accumulateBitFields(field, fieldEnd);
assert((field == fieldEnd || !field->isBitField()) &&
"Failed to accumulate all the bitfields");
} else if (!field->isZeroSize(astContext)) {
Expand Down
11 changes: 11 additions & 0 deletions clang/test/CIR/CodeGen/bitfields.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,23 @@ typedef struct {
// LLVM-DAG: %struct.U = type <{ i8, i8, i8, i8, i64 }>
// OGCG-DAG: %struct.U = type <{ i8, i8, i8, i8, i64 }>

typedef struct{
int a : 24;
char b;
int c: 30;
} Clip;

// CIR-DAG: !rec_Clip = !cir.record<struct "Clip" {!cir.array<!u8i x 3>, !s8i, !u32i}>
// LLVM-DAG: %struct.Clip = type { [3 x i8], i8, i32 }
// OGCG-DAG: %struct.Clip = type { [3 x i8], i8, i32 }

void def() {
A a;
D d;
S s;
T t;
U u;
Clip c;
}

int load_field(S* s) {
Expand Down