summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-07-17 00:59:30 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-07-17 00:59:30 +0000
commit18722981e2ae1a95426ea8da2db17254252b35e1 (patch)
tree34e2a4214688b21ced8a68267bac8d87244122a8 /clang/lib/Sema/SemaObjCProperty.cpp
parent50bd94f9618fe5e1f8510ebb2539b6848a3fcacd (diff)
downloadbcm5719-llvm-18722981e2ae1a95426ea8da2db17254252b35e1.tar.gz
bcm5719-llvm-18722981e2ae1a95426ea8da2db17254252b35e1.zip
Patch to synthesize property ivars on demand as
part of the new property synthesis by default. wip. llvm-svn: 108599
Diffstat (limited to 'clang/lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index ff60599b851..e7358edec3e 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -372,7 +372,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl, PropertyLoc,
PropertyIvar, PropType, /*Dinfo=*/0,
ObjCIvarDecl::Protected,
- (Expr *)0);
+ (Expr *)0, true);
ClassImpDecl->addDecl(Ivar);
IDecl->makeDeclVisibleInContext(Ivar, false);
property->setPropertyIvarDecl(Ivar);
@@ -517,6 +517,24 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(Scope *S,
return DeclPtrTy();
}
IC->addPropertyImplementation(PIDecl);
+ 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.
+ ObjCInterfaceDecl *ClassDeclared;
+ ObjCIvarDecl *Ivar = 0;
+ if (!Synthesize)
+ Ivar = IDecl->lookupInstanceVariable(PropertyId, ClassDeclared);
+ else {
+ if (PropertyIvar && PropertyIvar != PropertyId)
+ Ivar = IDecl->lookupInstanceVariable(PropertyId, ClassDeclared);
+ }
+ if (Ivar && Ivar->getSynthesize()) {
+ Diag(Ivar->getLocation(), diag::err_undeclared_var_use)
+ << PropertyId;
+ Ivar->setInvalidDecl();
+ }
+ }
} else {
if (Synthesize)
if (ObjCPropertyImplDecl *PPIDecl =
OpenPOWER on IntegriCloud