[clang] [Clang] Warn when an explicit alignment is weakened by other directives (PR #198417)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 5 07:05:45 PDT 2026
================
@@ -2047,6 +2055,13 @@ void ItaniumRecordLayoutBuilder::LayoutField(const FieldDecl *D,
CharUnits AlignTo =
!DefaultsToAIXPowerAlignment ? FieldAlign : PreferredAlign;
+
+ if (!MaxAlignmentInChars.isZero() && MaxAlignmentInChars > AlignTo) {
+ Diag(D->getLocation(), diag::warn_explicit_alignment_weakened)
+ << D->getName() << MaxAlignmentInChars.getQuantity()
----------------
AaronBallman wrote:
```suggestion
<< D << MaxAlignmentInChars.getQuantity()
```
https://github.com/llvm/llvm-project/pull/198417
More information about the cfe-commits
mailing list