summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-02-19 00:31:17 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-02-19 00:31:17 +0000
commitaef662206bce972589df4294bc5e299403bf6af6 (patch)
tree739a4e8831b6bafe71e6a07d0535d293ae82a8ea /clang/lib/AST/ASTContext.cpp
parent9baeb02000660bd570c9f3aaef21380a2489464c (diff)
downloadbcm5719-llvm-aef662206bce972589df4294bc5e299403bf6af6.tar.gz
bcm5719-llvm-aef662206bce972589df4294bc5e299403bf6af6.zip
Patch removes IVars list from ObjCInterfaceDecl and
instead relies on their DeclContext for iteration, etc. llvm-svn: 96638
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index c23babb9a4a..74212fe785d 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -872,14 +872,13 @@ void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI,
/// Collect all ivars, including those synthesized, in the current class.
///
void ASTContext::ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI,
- llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars,
- bool CollectSynthesized) {
+ llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) {
for (ObjCInterfaceDecl::ivar_iterator I = OI->ivar_begin(),
E = OI->ivar_end(); I != E; ++I) {
Ivars.push_back(*I);
}
- if (CollectSynthesized)
- CollectSynthesizedIvars(OI, Ivars);
+
+ CollectNonClassIvars(OI, Ivars);
}
void ASTContext::CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD,
@@ -895,10 +894,11 @@ void ASTContext::CollectProtocolSynthesizedIvars(const ObjCProtocolDecl *PD,
CollectProtocolSynthesizedIvars(*P, Ivars);
}
-/// CollectSynthesizedIvars -
-/// This routine collect synthesized ivars for the designated class.
+/// CollectNonClassIvars -
+/// This routine collects all other ivars which are not declared in the class.
+/// This includes synthesized ivars and those in class's implementation.
///
-void ASTContext::CollectSynthesizedIvars(const ObjCInterfaceDecl *OI,
+void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI,
llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) {
for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
E = OI->prop_end(); I != E; ++I) {
@@ -912,6 +912,13 @@ void ASTContext::CollectSynthesizedIvars(const ObjCInterfaceDecl *OI,
ObjCProtocolDecl *PD = (*P);
CollectProtocolSynthesizedIvars(PD, Ivars);
}
+
+ // Also add any ivar defined in this class's implementation
+ if (ObjCImplementationDecl *ImplDecl = OI->getImplementation()) {
+ for (ObjCImplementationDecl::ivar_iterator I = ImplDecl->ivar_begin(),
+ E = ImplDecl->ivar_end(); I != E; ++I)
+ Ivars.push_back(*I);
+ }
}
/// CollectInheritedProtocols - Collect all protocols in current class and
OpenPOWER on IntegriCloud