[PATCH] D39064: implement __has_unique_object_representations

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 24 08:03:35 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))
erichkeane wrote:
> 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).
@rnk: You're correct here I believe, I'm not properly checking the base class as I thought I was.  I'll get a new patch later today.


More information about the cfe-commits mailing list