[PATCH] D31003: [Objective-C] C++ Classes with __weak Members non-POD Types when using -fobjc-weak

Brian T. Kelley via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 15 15:25:49 PDT 2017


bkelley created this revision.

When adding an Objective-C retainable type member to a C++ class, also check the LangOpts.ObjCWeak flag and the lifetime qualifier so __weak qualified Objective-C pointer members cause the class to be a non-POD type with non-trivial special members, so the compiler always emits the necessary runtime calls for copying, moving, and destroying the weak member. Otherwise, Objective-C++ classes with weak Objective-C pointer members compiled with -fobjc-weak exhibit undefined behavior if the C++ class is classified as a POD type.


https://reviews.llvm.org/D31003

Files:
  lib/AST/DeclCXX.cpp
  lib/Sema/SemaDeclCXX.cpp
  test/CodeGenObjCXX/objc-weak.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31003.91921.patch
Type: text/x-patch
Size: 5461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170315/2d221c07/attachment-0001.bin>


More information about the cfe-commits mailing list