diff options
| author | Ted Kremenek <kremenek@apple.com> | 2011-10-25 04:52:20 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2011-10-25 04:52:20 +0000 |
| commit | 3045ce71304ec8ddef34ced5ee9fa9303f12432e (patch) | |
| tree | fc3664f10197546b8f7e93fb142106c9816a607e /lib/AST/DeclObjC.cpp | |
| parent | 6ca4a9ae99d65948e578d3e7d1f58ab6a947d2d7 (diff) | |
Relax restriction of assigning to 'self' in ARC when a method is attributed with ns_consumes_self. Fixes <rdar://problem/10274056>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
| -rw-r--r-- | lib/AST/DeclObjC.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 7eb2688134..5c4d25fd02 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -577,13 +577,13 @@ void ObjCMethodDecl::createImplicitParams(ASTContext &Context, selfIsConsumed = hasAttr<NSConsumesSelfAttr>(); // 'self' is always __strong. It's actually pseudo-strong except - // in init methods, though. + // in init methods (or methods labeled ns_consumes_self), though. Qualifiers qs; qs.setObjCLifetime(Qualifiers::OCL_Strong); selfTy = Context.getQualifiedType(selfTy, qs); // In addition, 'self' is const unless this is an init method. - if (getMethodFamily() != OMF_init) { + if (getMethodFamily() != OMF_init && !selfIsConsumed) { selfTy = selfTy.withConst(); selfIsPseudoStrong = true; } |
