[PATCH] D107394: [AIX] "aligned" attribute does not decrease alignment

Steven Wan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 3 13:16:37 PDT 2021


stevewan updated this revision to Diff 363860.
stevewan added a comment.

Attr 'packed' is already taken into account in ABIAlign/PreferredAlign


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107394

Files:
  clang/lib/AST/ASTContext.cpp


Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -2480,13 +2480,10 @@
   if (const auto *RT = T->getAs<RecordType>()) {
     const RecordDecl *RD = RT->getDecl();
 
-    if (RD->isInvalidDecl())
-      return ABIAlign;
-
     // When used as part of a typedef, or together with a 'packed' attribute,
     // the 'aligned' attribute can be used to decrease alignment.
-    if (TI.AlignIsRequired &&
-        (T->getAs<TypedefType>() != nullptr || RD->hasAttr<PackedAttr>()))
+    if ((TI.AlignIsRequired && T->getAs<TypedefType>() != nullptr) ||
+        RD->isInvalidDecl())
       return ABIAlign;
 
     unsigned PreferredAlign = static_cast<unsigned>(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107394.363860.patch
Type: text/x-patch
Size: 779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210803/6073a588/attachment.bin>


More information about the cfe-commits mailing list