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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 13:13:56 PST 2018


ahatanak updated this revision to Diff 128642.
ahatanak added a comment.

I've only fixed the places where the bits to track the triviality of special functions are set or reset, so this is still a WIP. I'll update the patch again later today, but let me know if anyone has any feedback in the meantime.

A couple of comments and questions about this patch:

- CXXRecordDecl and FunctionDecl still have the flags that keep track of the triviality of special functions for calls. I don't think we can avoid using them even under the new simpler rules? I also had to add "DeclaredNonTrivialSpecialMembersForCall" since ItaniumCXXABI::passClassIndirect needs to know whether a struct has a non-trivial destructor or copy constructor (I plan to make changes to  passClassIndirect later so that hasNonTrivial*ForCalls methods are called there).

- If a struct annotated with "trivial_abi" turns out to be ill-formed (because it has virtual bases, virtual functions, or __weak pointers), the attribute is dropped after all the members explicitly declared in the struct are seen. The triviality bits for user-provided special functions are set or reset only after we know whether "trivial_abi" has to be dropped or not. Currently, a diagnostic is printed if the struct becomes ill-formed because of the attribute, but it is possible to make changes to suppress them or make them more user-friendly.


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/CodeGen/MicrosoftCXXABI.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.128642.patch
Type: text/x-patch
Size: 44200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180104/d104d978/attachment-0001.bin>


More information about the cfe-commits mailing list