]> granicus.if.org Git - clang/commit
Add support for attribute 'trivial_abi'.
authorAkira Hatanaka <ahatanaka@apple.com>
Mon, 5 Feb 2018 20:23:22 +0000 (20:23 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Mon, 5 Feb 2018 20:23:22 +0000 (20:23 +0000)
commit9018322d0ffb51099c9a6ca7827bf14a2d2805d1
treec174bc7470cdba186de0ea1048a003388788c648
parent9658e036b90bc92b86c96a213d89fe87475701db
Add support for attribute 'trivial_abi'.

The 'trivial_abi' attribute can be applied to a C++ class, struct, or
union. It makes special functions of the annotated class (the destructor
and copy/move constructors) to be trivial for the purpose of calls and,
as a result, enables the annotated class or containing classes to be
passed or returned using the C ABI for the underlying type.

When a type that is considered trivial for the purpose of calls despite
having a non-trivial destructor (which happens only when the class type
or one of its subobjects is a 'trivial_abi' class) is passed to a
function, the callee is responsible for destroying the object.

For more background, see the discussions that took place on the mailing
list:

http://lists.llvm.org/pipermail/cfe-dev/2017-November/055955.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180101/thread.html#214043

rdar://problem/35204524

Differential Revision: https://reviews.llvm.org/D41039

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324269 91177308-0d34-0410-b5e6-96231b3b80d8
27 files changed:
include/clang/AST/ASTContext.h
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/ASTContext.cpp
lib/AST/DeclCXX.cpp
lib/AST/Type.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/ItaniumCXXABI.cpp
lib/CodeGen/MicrosoftCXXABI.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/SemaType.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterDecl.cpp
test/CodeGenCXX/trivial_abi.cpp [new file with mode: 0644]
test/CodeGenObjCXX/trivial_abi.mm [new file with mode: 0644]
test/Misc/pragma-attribute-supported-attributes-list.test
test/SemaObjCXX/attr-trivial-abi.mm [new file with mode: 0644]