diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-11-15 17:48:00 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-11-15 17:48:00 +0000 |
commit | 617e49ad59a96eb972e270fda36981ced0acb57c (patch) | |
tree | 8d093d0849c497e2779c6d910f80015ebb97c164 /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | a6dedc6cccd78ab6f04a32df08659fae60f1e42e (diff) | |
download | bcm5719-llvm-617e49ad59a96eb972e270fda36981ced0acb57c.tar.gz bcm5719-llvm-617e49ad59a96eb972e270fda36981ced0acb57c.zip |
ObjectiveC. Fixes a bogus warning of unused backing
ivar when property belongs to a super class and
currnt class happens to have a method with same name as
property. // rdar//15473432
llvm-svn: 194830
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 86979a1fe85..f44fb325114 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -3510,8 +3510,17 @@ Sema::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, Method = IDecl->lookupMethod(Method->getSelector(), true); if (!Method || !Method->isPropertyAccessor()) return 0; - if ((PDecl = Method->findPropertyDecl())) + if ((PDecl = Method->findPropertyDecl())) { + if (!PDecl->getDeclContext()) + return 0; + // Make sure property belongs to accessor's class and not to + // one of its super classes. + if (const ObjCInterfaceDecl *CID = + dyn_cast<ObjCInterfaceDecl>(PDecl->getDeclContext())) + if (CID != IDecl) + return 0; return PDecl->getPropertyIvarDecl(); + } return 0; } |