diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-03-11 19:44:54 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-03-11 19:44:54 +0000 |
| commit | 86838aafeee5c49ae87c33053742f2289dfda4fd (patch) | |
| tree | 8358e57178c163b23ed10b0d0ed0fbb50a04ee84 /clang/lib/Sema | |
| parent | 71d8d9b4688b09f78c50fc303100f45e389952b1 (diff) | |
| download | bcm5719-llvm-86838aafeee5c49ae87c33053742f2289dfda4fd.tar.gz bcm5719-llvm-86838aafeee5c49ae87c33053742f2289dfda4fd.zip | |
For ivars created using @synthesize, set their DeclContext to be
the @implementation (instead of the @interface) and actually add
the ivar to the DeclContext (which we weren't doing before).
This allows us to simplify ASTContext::CollectNonClassIvars() by
removing ASTContext::CollectProtocolSynthesizedIvars(). Now all
ivars can be found by either inspecting the ObjCInterfaceDecl and
its companion ObjCImplementationDecl.
llvm-svn: 98280
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 762ef38c973..da00951cafb 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -2492,15 +2492,17 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, ObjCInterfaceDecl *ClassDeclared; Ivar = IDecl->lookupInstanceVariable(PropertyIvar, ClassDeclared); if (!Ivar) { - DeclContext *EnclosingContext = cast_or_null<DeclContext>(IDecl); + DeclContext *EnclosingContext = cast_or_null<DeclContext>(ClassImpDecl); assert(EnclosingContext && "null DeclContext for synthesized ivar - ActOnPropertyImplDecl"); Ivar = ObjCIvarDecl::Create(Context, EnclosingContext, PropertyLoc, PropertyIvar, PropType, /*Dinfo=*/0, ObjCIvarDecl::Public, (Expr *)0); + EnclosingContext->addDecl(Ivar); IDecl->makeDeclVisibleInContext(Ivar, false); property->setPropertyIvarDecl(Ivar); + if (!getLangOptions().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; // Note! I deliberately want it to fall thru so, we have a |

