This patch adds support for a new attribute "trivial_abi", which will be used to instruct clang to pass and return non-trivial C++ structs directly when it's possible to do so. The original RFC I sent to cfe-dev last month is here:
http://lists.llvm.org/pipermail/cfe-dev/2017-November/055955.html
A couple of questions:
- The attribute is tentatively named "trivial_abi". Is there a better name that conveys what the attribute is supposed to do? How about c_abi or pass_by_value?
- Propagating the property of a "trivial_abi" class to the containing classes turned out to be more complicated than I initially expected. Do we really need or want clang to do that rather than asking users to annotate the containing classes with "trivial_abi"? If we do, is there a simpler way to accomplish that than what I did in this patch?
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.