[PATCH] D41039: Add support for attribute "trivial_abi"

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 23:19:14 PST 2018

rjmccall added a comment.

I'll trust Richard on the tricky Sema/AST bits.  The functionality of the patch looks basically acceptable to me, although I'm still not thrilled about the idea of actually removing the attribute from the AST rather than just letting it not have effect.  But we could clean that up later if it's significantly simpler to do it this way.

Please add a CodeGenObjCXX test case that `__weak` fields in ARC++ do actually override the `trivial_abi` attribute but that `__strong` fields do not.  Also, your test case does not seem to actually test arrays of `__weak` references.

Comment at: lib/CodeGen/CGDecl.cpp:1825
+    HasTrivialABIOverride =
+        RD->canPassInRegisters() && RD->hasNonTrivialDestructor();
You could make a helper function to do this computation and then declare it in some internal-to-IRGen header so that you don't write it out multiple times.


More information about the cfe-commits mailing list