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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 15:37:03 PST 2017


ahatanak created this revision.
Herald added a subscriber: javed.absar.

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:

1. 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?

2. 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?


https://reviews.llvm.org/D41039

Files:
  include/clang/AST/Decl.h
  include/clang/AST/DeclCXX.h
  include/clang/AST/Type.h
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/AST/DeclCXX.cpp
  lib/AST/Type.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaType.cpp
  test/CodeGenCXX/trivial_abi.cpp
  test/Misc/pragma-attribute-supported-attributes-list.test
  test/SemaObjCXX/attr-trivial-abi.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41039.126223.patch
Type: text/x-patch
Size: 42605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171208/270c17d1/attachment-0001.bin>


More information about the cfe-commits mailing list