[PATCH] D45384: [ObjC++] Never pass structs with `__weak` fields in registers

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 6 14:31:22 PDT 2018


rjmccall added a comment.

In https://reviews.llvm.org/D45384#1060192, @ahatanak wrote:

> In https://reviews.llvm.org/D45384#1060164, @rjmccall wrote:
>
> > Well, but I think CanPassInRegisters==false in the base class does always mean CanPassInRegisters==false in the subclass.
>
>
> I think there are cases that is not true. If I compile the following code, S0 (base class) is passed indirectly and S1 (derived class) is passed directly.


Yes, I think you're right.  That's exciting.

So "cannot pass in registers" is tracking whether there's a primitive reason that the class cannot be passed in registers, something that's above and beyond the C++ rules?  Okay.



================
Comment at: include/clang/AST/DeclCXX.h:486
+    /// for this class to be passed in registers.
+    unsigned CannotPassInRegisters : 1;
+
----------------
You should definitely explain the semantic difference with CanPassInRegisters in this comment, and I think the field/method names should underline that.  Maybe this is a place to pull out "Primitive" again?


Repository:
  rC Clang

https://reviews.llvm.org/D45384





More information about the cfe-commits mailing list