[Sema][ObjC] Mark C union fields that have non-trivial ObjC ownership
authorAkira Hatanaka <ahatanaka@apple.com>
Sat, 7 Sep 2019 00:34:47 +0000 (00:34 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Sat, 7 Sep 2019 00:34:47 +0000 (00:34 +0000)
commit3f2c9917a4310a2835ffcc5a7be6226d0d218682
tree9bd9a1aa4ba312302ae9291f37809b9a9ac7b884
parent090510608da404a0e1c80fa29eb5fc18f2d91755
[Sema][ObjC] Mark C union fields that have non-trivial ObjC ownership
qualifications as unavailable if the union is declared in a system
header

r365985 stopped marking those fields as unavailable, which caused the
union's NonTrivialToPrimitive* bits to be set to true. This patch
restores the behavior prior to r365985, except that users can explicitly
specify the ownership qualification of the field to instruct the
compiler not to mark it as unavailable.

rdar://problem/53420753

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

llvm-svn: 371276
clang/include/clang/AST/ASTContext.h
clang/lib/AST/ASTContext.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaType.cpp
clang/test/SemaObjC/Inputs/non-trivial-c-union.h [new file with mode: 0644]
clang/test/SemaObjC/non-trivial-c-union.m