aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-24 18:48:05 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-24 18:48:05 +0000
commitcdaa6a8fed16d8bd3987fb4f3304dfb4e52876c3 (patch)
tree59792cbe15bf7fbbe841371685696777859af7d6 /lib/Sema/SemaObjCProperty.cpp
parentffc52e78a27564d0512d42ed5c98a5588cf906b5 (diff)
Fix a bug in nonfragile-abi2 when attempting to diagnose
previous use of a synthesized 'ivar' with property of same name declared as @dynamic. In this case, 'ivar' is in the inherited class and no diagnostics should be issued. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index ccb9a15ff2..91f47ab708 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -521,7 +521,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
if (getLangOptions().ObjCNonFragileABI2) {
// Diagnose if an ivar was lazily synthesdized due to a previous
// use and if 1) property is @dynamic or 2) property is synthesized
- // but it requires a dirreferently named ivar.
+ // but it requires an ivar of different name.
ObjCInterfaceDecl *ClassDeclared;
ObjCIvarDecl *Ivar = 0;
if (!Synthesize)
@@ -530,7 +530,9 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
if (PropertyIvar && PropertyIvar != PropertyId)
Ivar = IDecl->lookupInstanceVariable(PropertyId, ClassDeclared);
}
- if (Ivar && Ivar->getSynthesize()) {
+ // Issue diagnostics only if Ivar belongs to current class.
+ if (Ivar && Ivar->getSynthesize() &&
+ IC->getClassInterface() == ClassDeclared) {
Diag(Ivar->getLocation(), diag::err_undeclared_var_use)
<< PropertyId;
Ivar->setInvalidDecl();