summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-01-27 22:27:43 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-01-27 22:27:43 +0000
commit122d94fd613efdd2fff30b13ebdd6e187780537d (patch)
treeeed0e2a5b9b201176f9cd6b4146e61efabed8c57 /clang/lib/Sema/SemaDeclObjC.cpp
parent89c37499ddd005df1c38605966af8c524b9adf79 (diff)
downloadbcm5719-llvm-122d94fd613efdd2fff30b13ebdd6e187780537d.tar.gz
bcm5719-llvm-122d94fd613efdd2fff30b13ebdd6e187780537d.zip
ObjectiveC. Fixes a bug in recognition of an ivar
backing a property resulting in bogus warning. // rdar://15890251 llvm-svn: 200254
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 7d023e1d403..c91ce37711b 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -3449,8 +3449,14 @@ Sema::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
if (!Method || !Method->isPropertyAccessor())
return 0;
if ((PDecl = Method->findPropertyDecl()))
- return PDecl->getPropertyIvarDecl();
-
+ if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl()) {
+ // property backing ivar must belong to property's class
+ // or be a private ivar in class's implementation.
+ // FIXME. fix the const-ness issue.
+ IV = const_cast<ObjCInterfaceDecl *>(IDecl)->lookupInstanceVariable(
+ IV->getIdentifier());
+ return IV;
+ }
return 0;
}
@@ -3509,13 +3515,6 @@ void Sema::DiagnoseUnusedBackingIvarInAccessor(Scope *S,
const ObjCIvarDecl *IV = GetIvarBackingPropertyAccessor(CurMethod, PDecl);
if (!IV)
continue;
- // Property declared as @dynamic must be ignored.
- if (ObjCPropertyImplDecl *PropertyImpDecl =
- Context.getObjCPropertyImplDeclForPropertyDecl(PDecl, ImplD))
- if (PropertyImpDecl->getPropertyImplementation() ==
- ObjCPropertyImplDecl::Dynamic)
- continue;
-
UnusedBackingIvarChecker Checker(*this, CurMethod, IV);
Checker.TraverseStmt(CurMethod->getBody());
OpenPOWER on IntegriCloud