diff options
author | John McCall <rjmccall@apple.com> | 2015-11-19 02:28:03 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2015-11-19 02:28:03 +0000 |
commit | 00b2bbb7bb5a02306095db2b39d7bf9bc12df90d (patch) | |
tree | 44544c17e94d76a965ffa1a0f6829533ddec5b1d /clang/lib/CodeGen | |
parent | d80218fa4221c76fa1b822a406253921d4c7f8fc (diff) | |
download | bcm5719-llvm-00b2bbb7bb5a02306095db2b39d7bf9bc12df90d.tar.gz bcm5719-llvm-00b2bbb7bb5a02306095db2b39d7bf9bc12df90d.zip |
Don't actually add the __unsafe_unretained qualifier in MRC;
driving a canonical difference between that and an unqualified
type is a really bad idea when both are valid. Instead, remember
that it was there in a non-canonical way, then look for that in
the one place we really care about it: block captures. The net
effect closely resembles the behavior of a decl attribute, except
still closely following ARC's standard qualifier parsing rules.
llvm-svn: 253534
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 18e766dba53..87165fe13a4 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -399,9 +399,15 @@ static void computeBlockInfo(CodeGenModule &CGM, CodeGenFunction *CGF, // Block pointers require copy/dispose. So do Objective-C pointers. } else if (variable->getType()->isObjCRetainableType()) { - info.NeedsCopyDispose = true; - // used for mrr below. - lifetime = Qualifiers::OCL_Strong; + // But honor the inert __unsafe_unretained qualifier, which doesn't + // actually make it into the type system. + if (variable->getType()->isObjCInertUnsafeUnretainedType()) { + lifetime = Qualifiers::OCL_ExplicitNone; + } else { + info.NeedsCopyDispose = true; + // used for mrr below. + lifetime = Qualifiers::OCL_Strong; + } // So do types that require non-trivial copy construction. } else if (CI.hasCopyExpr()) { |