diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2018-03-12 17:05:06 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-03-12 17:05:06 +0000 |
commit | be7daa3d50e8a65e6bba6b522768ca225b818c39 (patch) | |
tree | 5f807d6ceabb3a1905d891ad6c85fdd7cc7c84db /clang/lib/CodeGen/CGBlocks.cpp | |
parent | 144b0c8036e1edac15ff1a69faa31eb23c1eef3f (diff) | |
download | bcm5719-llvm-be7daa3d50e8a65e6bba6b522768ca225b818c39.tar.gz bcm5719-llvm-be7daa3d50e8a65e6bba6b522768ca225b818c39.zip |
Revert "[ObjC] Allow declaring __weak pointer fields in C structs in
ARC."
This reverts commit r327206 as there were test failures caused by this
patch.
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180312/221427.html
llvm-svn: 327294
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 2c34447ec7e..132314ad2dc 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -1525,9 +1525,6 @@ computeCopyInfoForBlockCapture(const BlockDecl::Capture &CI, QualType T, case QualType::PCK_Struct: return std::make_pair(BlockCaptureEntityKind::NonTrivialCStruct, BlockFieldFlags()); - case QualType::PCK_ARCWeak: - // We need to register __weak direct captures with the runtime. - return std::make_pair(BlockCaptureEntityKind::ARCWeak, Flags); case QualType::PCK_ARCStrong: // We need to retain the copied value for __strong direct captures. // If it's a block pointer, we have to copy the block and assign that to @@ -1545,6 +1542,10 @@ computeCopyInfoForBlockCapture(const BlockDecl::Capture &CI, QualType T, // Special rules for ARC captures: Qualifiers QS = T.getQualifiers(); + // We need to register __weak direct captures with the runtime. + if (QS.getObjCLifetime() == Qualifiers::OCL_Weak) + return std::make_pair(BlockCaptureEntityKind::ARCWeak, Flags); + // Non-ARC captures of retainable pointers are strong and // therefore require a call to _Block_object_assign. if (!QS.getObjCLifetime() && !LangOpts.ObjCAutoRefCount) |