[PATCH] D39064: implement __has_unique_object_representations

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 18:17:32 PDT 2017


erichkeane added inline comments.


================
Comment at: lib/AST/Type.cpp:2226
+        Context.getFieldOffset(*Record->field_begin()));
+    for (const auto *Field : Record->fields()) {
+      if (!Field->getType().hasUniqueObjectRepresentations(Context))
----------------
rnk wrote:
> What about base classes? I think that's where the padding detection is going to get wacky. =/
Based on my reading of the RecordLayout stuff, the "getFieldOffset" should take that into account, right?  It seems that 'fields' contains all fields, and thus should run through the offset of all of them, right?  I'll add another test that inherits from a Padded struct to verify (as well as one that causes padding with the inheritence).


https://reviews.llvm.org/D39064





More information about the cfe-commits mailing list