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
This commit is contained in:
John McCall
2015-11-19 02:28:03 +00:00
parent d80218fa42
commit 00b2bbb7bb
8 changed files with 275 additions and 7 deletions

View File

@@ -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()) {