[PATCH] D62988: Add an attribute to allow fields of non-trivial types in C unions

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 11:23:10 PDT 2019


rjmccall added a comment.

For ARC, you could bzero the union member; this is what how we tell people to initialize malloc'ed memory as well, since there's no default-constructor concept that they can invoke for such cases.

Our immediate need for this attribute is that we have some code that wants to adopt non-trivial annotations in unions, with no intention of ever copying or destroying them as aggregates.  Of course a better solution would be to make any C code that would copy or destroy the aggregate type illegal, but that seems like a big project.  But maybe there'd be no need for this attribute in the long term if we eventually do have that support.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62988/new/

https://reviews.llvm.org/D62988





More information about the cfe-commits mailing list