================ @@ -803,10 +804,16 @@ bool ConstStructBuilder::Build(const InitListExpr *ILE, bool AllowOverwrite) { if (!AppendField(Field, Layout.getFieldOffset(FieldNo), EltInit, AllowOverwrite)) return false; - // After emitting a non-empty field with [[no_unique_address]], we may - // need to overwrite its tail padding. - if (Field->hasAttr<NoUniqueAddressAttr>()) - AllowOverwrite = true; + + // Allow overwrites after a field with tail padding. This allows + // overwriting tail padding of fields carrying [[no_unique_address]] + // without checking for it, since it is not necessarily present in debug + // info. ---------------- rnk wrote:
BTW, I attempted making this logic conditional on whether an external AST provider is present, but consider that PCH and PCM files are implemented as external AST sources, so that approach disturbed record layouts of too many unrelated tests. There is no easy way to query whether a record has an externally dictated layout, although we could probably pipe that through as an ASTRecordLayout field if we wanted to. I decided that the best approach is to have the fewest possible conditions, and to only look at the layout data, which is the same between compilation and debugging. https://github.com/llvm/llvm-project/pull/122197 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits