efriedma added a comment.

This approach seems to reflect the consensus from the mailing list.



================
Comment at: clang/include/clang/AST/RecordLayout.h:74
+  /// The maximum allowed field alignment. This is set by #pragma pack.
+  CharUnits MaxFieldAlignment;
+
----------------
If we have to keep around extra data anyway, probably better to add a field for 
the preferred alignment, so we can keep the preferred alignment handling 
together.


================
Comment at: clang/lib/AST/ASTContext.cpp:2518
+      (T->isSpecificBuiltinType(BuiltinType::LongDouble) &&
+       getTargetInfo().getTriple().isOSAIX()))
     // Don't increase the alignment if an alignment attribute was specified on 
a
----------------
We try to avoid OS-specific checks here.  But I'm not sure what this should 
look like on other targets.


================
Comment at: clang/lib/AST/ASTContext.cpp:2527
+    // as its first member.
+    if (getTargetInfo().getTriple().isOSAIX()) {
+      const RecordDecl *RD = RT->getDecl();
----------------
I'd prefer to centralize the check for "AIX struct layout" in one place, as 
opposed to putting checks for AIX targets in multiple places.


================
Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:3438
+                                C.getPreferredTypeAlign(RD->getTypeForDecl()))
+                               .getQuantity());
 
----------------
Please don't make the dumping code lie about the "align".  If you want to dump 
the preferred alignment in addition, that would be fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79719



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to