diff options
author | John McCall <rjmccall@apple.com> | 2013-04-04 01:38:37 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-04-04 01:38:37 +0000 |
commit | b846381fc3099b2340ba8c74d16178203a60d9a0 (patch) | |
tree | ca5c1efa138e72daf9ccc5bade8bf84ffa395f0a /lib/Sema/SemaDeclObjC.cpp | |
parent | d08f5952a7119403ed8054ff7acd072a51a762ec (diff) |
Be sure to check ARC conventions on the implicit method declarations
of a property just in case the property's getter happens to be +1.
We won't synthesize a getter for such a property, but we will allow
the user to define a +1 method for it.
rdar://13115896
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 5d16f3eae6..96a432a108 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -193,7 +193,7 @@ void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, /// \brief Check a method declaration for compatibility with the Objective-C /// ARC conventions. -static bool CheckARCMethodDecl(Sema &S, ObjCMethodDecl *method) { +bool Sema::CheckARCMethodDecl(ObjCMethodDecl *method) { ObjCMethodFamily family = method->getMethodFamily(); switch (family) { case OMF_None: @@ -207,17 +207,17 @@ static bool CheckARCMethodDecl(Sema &S, ObjCMethodDecl *method) { return false; case OMF_dealloc: - if (!S.Context.hasSameType(method->getResultType(), S.Context.VoidTy)) { + if (!Context.hasSameType(method->getResultType(), Context.VoidTy)) { SourceRange ResultTypeRange; if (const TypeSourceInfo *ResultTypeInfo = method->getResultTypeSourceInfo()) ResultTypeRange = ResultTypeInfo->getTypeLoc().getSourceRange(); if (ResultTypeRange.isInvalid()) - S.Diag(method->getLocation(), diag::error_dealloc_bad_result_type) + Diag(method->getLocation(), diag::error_dealloc_bad_result_type) << method->getResultType() << FixItHint::CreateInsertion(method->getSelectorLoc(0), "(void)"); else - S.Diag(method->getLocation(), diag::error_dealloc_bad_result_type) + Diag(method->getLocation(), diag::error_dealloc_bad_result_type) << method->getResultType() << FixItHint::CreateReplacement(ResultTypeRange, "void"); return true; @@ -226,11 +226,11 @@ static bool CheckARCMethodDecl(Sema &S, ObjCMethodDecl *method) { case OMF_init: // If the method doesn't obey the init rules, don't bother annotating it. - if (S.checkInitMethod(method, QualType())) + if (checkInitMethod(method, QualType())) return true; - method->addAttr(new (S.Context) NSConsumesSelfAttr(SourceLocation(), - S.Context)); + method->addAttr(new (Context) NSConsumesSelfAttr(SourceLocation(), + Context)); // Don't add a second copy of this attribute, but otherwise don't // let it be suppressed. @@ -249,8 +249,8 @@ static bool CheckARCMethodDecl(Sema &S, ObjCMethodDecl *method) { break; } - method->addAttr(new (S.Context) NSReturnsRetainedAttr(SourceLocation(), - S.Context)); + method->addAttr(new (Context) NSReturnsRetainedAttr(SourceLocation(), + Context)); return false; } @@ -3032,7 +3032,7 @@ Decl *Sema::ActOnMethodDeclaration( bool ARCError = false; if (getLangOpts().ObjCAutoRefCount) - ARCError = CheckARCMethodDecl(*this, ObjCMethod); + ARCError = CheckARCMethodDecl(ObjCMethod); // Infer the related result type when possible. if (!ARCError && RTC == Sema::RTC_Compatible && |