[PATCH] Microsoft Record Layout Required Alignment

Warren Hunt whunt at google.com
Wed Dec 4 12:59:03 PST 2013



================
Comment at: lib/AST/RecordLayoutBuilder.cpp:2156
@@ +2155,3 @@
+  if (!MaxFieldAlignment.isZero())
+    BaseAlignment = std::min(BaseAlignment,
+                             std::max(MaxFieldAlignment,
----------------
Reid Kleckner wrote:
> Remind me why this is a min?
#pragma pack(n) // which induces MaxFieldAlignment
says that the alignment of any field is at *most* n


================
Comment at: include/clang/AST/RecordLayout.h:87
@@ +86,3 @@
+    /// the __declspec(align()) trumps #pramga pack and must always be obeyed.
+    CharUnits RequiredAlignment;
+
----------------
Reid Kleckner wrote:
> What about record subobjects in plain C?  Don't they also have this property?  Seems like it needs to live on ASTRecordLayout.
You're absolutely right, this is a property that C also has and should live in the ASTRecordLayout rather than the CXXInfo.



http://llvm-reviews.chandlerc.com/D2283



More information about the cfe-commits mailing list