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>(


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>(
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to