summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-04-13 19:30:37 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-04-13 19:30:37 +0000
commitb6d5b54839049479df20759a92755e0481a4d760 (patch)
treeae1898b69400dcd67a837c4fa4eeec9c7437b342 /clang/lib/Sema/SemaDeclObjC.cpp
parent84073ec51f39cf6d4b8cbd43187583f5b98d131a (diff)
downloadbcm5719-llvm-b6d5b54839049479df20759a92755e0481a4d760.tar.gz
bcm5719-llvm-b6d5b54839049479df20759a92755e0481a4d760.zip
In objc2's None-Fragile ABI, one cannot use the super class ivar for
setter/getter synthesis. llvm-svn: 68976
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index cf782caf5c0..d468c1334ea 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1791,11 +1791,13 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
// Check that we have a valid, previously declared ivar for @synthesize
if (Synthesize) {
// @synthesize
+ bool NoExplicitPropertyIvar = (!PropertyIvar);
if (!PropertyIvar)
PropertyIvar = PropertyId;
QualType PropType = Context.getCanonicalType(property->getType());
// Check that this is a previously declared 'ivar' in 'IDecl' interface
- Ivar = IDecl->lookupInstanceVariable(Context, PropertyIvar);
+ ObjCInterfaceDecl *ClassDeclared;
+ Ivar = IDecl->lookupInstanceVariable(Context, PropertyIvar, ClassDeclared);
if (!Ivar) {
if (getLangOptions().ObjCNonFragileABI) {
Ivar = ObjCIvarDecl::Create(Context, CurContext, PropertyLoc,
@@ -1809,6 +1811,15 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
return DeclPtrTy();
}
}
+ else if (getLangOptions().ObjCNonFragileABI &&
+ NoExplicitPropertyIvar && ClassDeclared != IDecl) {
+ Diag(PropertyLoc, diag::error_ivar_in_superclass_use)
+ << property->getDeclName() << Ivar->getDeclName()
+ << ClassDeclared->getDeclName();
+ Diag(Ivar->getLocation(), diag::note_previous_access_declaration)
+ << Ivar << Ivar->getNameAsCString();
+ // Note! I deliberately want it to fall thru so more errors are caught.
+ }
QualType IvarType = Context.getCanonicalType(Ivar->getType());
// Check that type of property and its ivar are type compatible.
OpenPOWER on IntegriCloud