================
@@ -2452,6 +2481,41 @@ static bool mustSkipTailPadding(TargetCXXABI ABI, const 
CXXRecordDecl *RD) {
   llvm_unreachable("bad tail-padding use kind");
 }
 
+void ItaniumRecordLayoutBuilder::DiagnoseAlignmentWeakeningSource(
+    const Decl *RD, CharUnits Weakened, bool DueToPackedAttr) {
+  enum WeakeningSource {
+    WS_PragmaPack,
+    WS_PackedAttr,
+    WS_PragmaOptionsAlign,
+    WS_CommandLine,
+  };
+  WeakeningSource Source;
+  SourceLocation Loc;
+
+  if (DueToPackedAttr) {
+    Source = WS_PackedAttr;
+    if (const auto *PA = RD->getAttr<PackedAttr>())
+      Loc = PA->getLocation();
+  } else if (RD->hasAttr<AlignMac68kAttr>()) {
+    Source = WS_PragmaOptionsAlign;
+    if (const auto *A = RD->getAttr<AlignMac68kAttr>())
+      Loc = A->getLocation();
+  } else if (const auto *MFAA = RD->getAttr<MaxFieldAlignmentAttr>()) {
+    Source = WS_PragmaPack;
+    Loc = MFAA->getLocation();
+  } else {
+    Source = WS_CommandLine;
+  }
+
+  // Fall back to the record location.
----------------
davidmenggx wrote:

Alternatively we could omit the note in this case

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

Reply via email to