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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 10:12:08 PST 2018


ahatanak marked 10 inline comments as done.
ahatanak added inline comments.


================
Comment at: include/clang/AST/DeclCXX.h:443
+    /// SMF_MoveConstructor, and SMF_Destructor are meaningful here.
+    unsigned HasTrivialSpecialMembersForCall : 6;
+
----------------
rjmccall wrote:
> I think you could probably get away with only three bits here (and below) if you reorder those three values to be the first three.  I don't know if that's important in terms of packing DefinitionData at all.  Should be okay to not do for now.
Yes, only three bits are needed here. I'll fix this later.


================
Comment at: include/clang/AST/DeclCXX.h:478
+    /// ill-formed if it is annotated with "trivial_abi".
+    unsigned DropTrivialABI : 1;
+
----------------
rjmccall wrote:
> So is it actually interesting to drop the attribute from the AST?  And why is this bit necessary vs., say, just checking whether the attribute is present but the class is not trivial-for-calls?
I think we need to check whether a struct annotated with "trivial_abi" is ill-formed before ActOnFields and CheckCompletedCXXClass set the triviality flags in Sema::ActOnFinishCXXMemberSpecification and drop the attribute if it is ill-formed. If we don't want to drop the attribute, we will have to find out whether "trivial_abi" has no effect before calls to FunctionDecl::setTrivialForCall are made.

I added this bit to CXXRecordDecl in the previous patch because I felt hesitant to iterate over the base classes and members of the class again, but I think that is better than adding a bit just to check whether the class is ill-formed. I've removed the bit in the new patch.


https://reviews.llvm.org/D41039





More information about the cfe-commits mailing list