royjacobson marked 2 inline comments as done.
royjacobson added inline comments.


================
Comment at: clang/lib/AST/ASTContext.cpp:2817
+    // unique representation.
+    if (Field->isUnnamedBitfield() && BitfieldSize > 0)
+      return std::nullopt;
----------------
aaron.ballman wrote:
> I think the check for a non-zero bit-field width might not be completely 
> correct in cases where it's used to split an allocation unit. I suggested a 
> test case below.
That was actually fine: the padding bits would not be a part of the unnamed bit 
field so they're detected.

Then I realized that the surrounding code just sums the object representation 
bits and checks if that equals `sizeof(T)`. But unnamed fields don't contribute 
any bits to the object representation. So a simpler way to fix this is to 
return 0 unconditionally.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145852/new/

https://reviews.llvm.org/D145852

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to