aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-03-31 00:06:29 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-03-31 00:06:29 +0000
commitaf3e72285238369c2ea4ebd40a1c9a87bd3eabb7 (patch)
treed7a00fc22bf624e4f281eaa55a86c39a3b500365 /lib
parent0e3e3eb3879d5a7aaca4a393706149ddef8544f1 (diff)
fe support for objc2's nonfragile-abi synthesized ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp7
-rw-r--r--lib/AST/DeclObjC.cpp10
-rw-r--r--lib/Sema/SemaDeclObjC.cpp17
3 files changed, 28 insertions, 6 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index bb17954727..b62438cd61 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -608,6 +608,13 @@ void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI,
if (!IVDecl->isInvalidDecl())
Fields.push_back(cast<FieldDecl>(IVDecl));
}
+ // look into properties.
+ for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
+ E = OI->prop_end(); I != E; ++I) {
+ ObjCPropertyDecl *PDecl = (*I);
+ if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl())
+ Fields.push_back(cast<FieldDecl>(IV));
+ }
}
/// addRecordToClass - produces record info. for the class for its
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 4d2fcb69ac..855764fdbd 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -137,6 +137,16 @@ ObjCIvarDecl *ObjCInterfaceDecl::lookupInstanceVariable(
return *I;
}
}
+ // look into properties.
+ for (ObjCInterfaceDecl::prop_iterator I = ClassDecl->prop_begin(),
+ E = ClassDecl->prop_end(); I != E; ++I) {
+ ObjCPropertyDecl *PDecl = (*I);
+ if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl())
+ if (IV->getIdentifier() == ID) {
+ clsDeclared = ClassDecl;
+ return IV;
+ }
+ }
ClassDecl = ClassDecl->getSuperClass();
}
return NULL;
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 18e3e4f909..c68eede104 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1765,17 +1765,22 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc,
// @synthesize
if (!PropertyIvar)
PropertyIvar = PropertyId;
+ QualType PropType = Context.getCanonicalType(property->getType());
// Check that this is a previously declared 'ivar' in 'IDecl' interface
Ivar = IDecl->lookupInstanceVariable(PropertyIvar);
if (!Ivar) {
- if (getLangOptions().ObjCNonFragileABI)
- Diag(PropertyLoc, diag::error_synthesized_ivar_yet_not_supported)
- << PropertyId;
- else
+ if (getLangOptions().ObjCNonFragileABI) {
+ Ivar = ObjCIvarDecl::Create(Context, CurContext, PropertyLoc,
+ PropertyIvar, PropType,
+ ObjCIvarDecl::Private,
+ (Expr *)0);
+ property->setPropertyIvarDecl(Ivar);
+ }
+ else {
Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId;
- return DeclPtrTy();
+ return DeclPtrTy();
+ }
}
- QualType PropType = Context.getCanonicalType(property->getType());
QualType IvarType = Context.getCanonicalType(Ivar->getType());
// Check that type of property and its ivar are type compatible.