[clang] [CIR] Add initial support for bitfields in structs (PR #142041)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri May 30 13:44:01 PDT 2025


================
@@ -223,21 +272,114 @@ void CIRRecordLowering::fillOutputFields() {
             fieldTypes.size() - 1;
       // A field without storage must be a bitfield.
       assert(!cir::MissingFeatures::bitfields());
+      if (!member.data)
+        setBitFieldInfo(member.fieldDecl, member.offset, fieldTypes.back());
     }
     assert(!cir::MissingFeatures::cxxSupport());
   }
 }
 
+void CIRRecordLowering::accumulateBitFields(
+    RecordDecl::field_iterator field, RecordDecl::field_iterator fieldEnd) {
+  // Run stores the first element of the current run of bitfields.  FieldEnd is
----------------
andykaylor wrote:

```suggestion
  // 'run' stores the first element of the current run of bitfields. 'fieldEnd' is
```

https://github.com/llvm/llvm-project/pull/142041


More information about the cfe-commits mailing list