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/AST/ASTContext.cpp | |
| 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/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 26b10b58713..079c16ac6b2 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -971,22 +971,10 @@ void ASTContext::ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI, CollectNonClassIvars(OI, Ivars); } -void ASTContext::CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD, - llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) { - for (ObjCContainerDecl::prop_iterator I = PD->prop_begin(), - E = PD->prop_end(); I != E; ++I) - if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl()) - Ivars.push_back(Ivar); - - // Also look into nested protocols. - for (ObjCProtocolDecl::protocol_iterator P = PD->protocol_begin(), - E = PD->protocol_end(); P != E; ++P) - CollectProtocolSynthesizedIvars(*P, Ivars); -} - /// CollectNonClassIvars - /// This routine collects all other ivars which are not declared in the class. -/// This includes synthesized ivars and those in class's implementation. +/// This includes synthesized ivars (via @synthesize) and those in +// class's @implementation. /// void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI, llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) { @@ -997,21 +985,9 @@ void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI, Ivars.push_back(*I); } } - - for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(), - E = OI->prop_end(); I != E; ++I) { - if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl()) - Ivars.push_back(Ivar); - } - // Also look into interface's protocol list for properties declared - // in the protocol and whose ivars are synthesized. - for (ObjCInterfaceDecl::protocol_iterator P = OI->protocol_begin(), - PE = OI->protocol_end(); P != PE; ++P) { - ObjCProtocolDecl *PD = (*P); - CollectProtocolSynthesizedIvars(PD, Ivars); - } - // Also add any ivar defined in this class's implementation + // Also add any ivar defined in this class's implementation. This + // includes synthesized ivars. if (ObjCImplementationDecl *ImplDecl = OI->getImplementation()) { for (ObjCImplementationDecl::ivar_iterator I = ImplDecl->ivar_begin(), E = ImplDecl->ivar_end(); I != E; ++I) |

