================
@@ -1487,6 +1487,14 @@ BitFieldType::getABIAlignment(const mlir::DataLayout 
&dataLayout,
   return 1;
 }
 
+std::optional<uint64_t> BitFieldType::getDeclaredExtentInBits(
+    const mlir::DataLayout &dataLayout) const {
+  if (getFields().size() != 1)
+    return std::nullopt;
+  return dataLayout.getTypeSizeInBits(getFields().front().getDeclaredType())
----------------
adams381 wrote:

It returns nullopt for a multi-declaration unit, so `front()` only runs when 
there's exactly one.  A later declaration starts partway into the unit, so its 
declared size doesn't describe what the unit covers from bit zero.  I had 
considered naming this `getSoleDeclaredExtentInBits`, and can go with that if 
it makes it more clear.

https://github.com/llvm/llvm-project/pull/222108
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to