[ObjC] Allow declaring __weak pointer fields in C structs in ARC.
authorAkira Hatanaka <ahatanaka@apple.com>
Mon, 19 Mar 2018 17:38:40 +0000 (17:38 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Mon, 19 Mar 2018 17:38:40 +0000 (17:38 +0000)
commitd791e92b5fbd24eef539d5de738c41b835246539
tree880a6ae213922227398cd812298e69e4290c4ca2
parent259eaa6e7cd021c75e36da2ea677103a6847eb38
[ObjC] Allow declaring __weak pointer fields in C structs in ARC.

This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.

This recommits r327206, which was reverted because it caused
module-enabled builders to fail. I discovered that the
CXXRecordDecl::CanPassInRegisters flag wasn't being set correctly in
some cases after I moved it to RecordDecl.

Thanks to Eric Liu for helping me investigate the bug.

rdar://problem/33599681

https://reviews.llvm.org/D44095

llvm-svn: 327870
22 files changed:
clang/include/clang/AST/Decl.h
clang/include/clang/AST/DeclCXX.h
clang/include/clang/AST/Type.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/Decl.cpp
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/Type.cpp
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGNonTrivialStruct.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/CodeGenObjC/nontrivial-c-struct-exception.m
clang/test/CodeGenObjC/weak-in-c-struct.m [new file with mode: 0644]
clang/test/Modules/Inputs/module.map
clang/test/Modules/Inputs/template-nontrivial0.h [new file with mode: 0644]
clang/test/Modules/Inputs/template-nontrivial1.h [new file with mode: 0644]
clang/test/Modules/templates.mm