aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-22 04:39:47 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-22 04:39:47 +0000
commitd4ae6c038ea8dd2faaadd1f9da725ec37b4f7ef9 (patch)
treebef05313f4b219338fb2bb7edf65e097a2754cdf /lib/AST/ASTContext.cpp
parent3b3a45858c6b2a45114e91902c3bf3c4b7f5f302 (diff)
Revert r69771, I missed some (obvious) details. :/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp43
1 files changed, 10 insertions, 33 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index af7cf124ef..f156ac458c 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -621,9 +621,11 @@ void ASTRecordLayout::LayoutField(const FieldDecl *FD, unsigned FieldNo,
Alignment = std::max(Alignment, FieldAlign);
}
-static void CollectLocalObjCIvars(ASTContext *Ctx,
- const ObjCInterfaceDecl *OI,
- llvm::SmallVectorImpl<FieldDecl*> &Fields) {
+void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI,
+ llvm::SmallVectorImpl<FieldDecl*> &Fields) {
+ const ObjCInterfaceDecl *SuperClass = OI->getSuperClass();
+ if (SuperClass)
+ CollectObjCIvars(SuperClass, Fields);
for (ObjCInterfaceDecl::ivar_iterator I = OI->ivar_begin(),
E = OI->ivar_end(); I != E; ++I) {
ObjCIvarDecl *IVDecl = *I;
@@ -631,28 +633,20 @@ static void CollectLocalObjCIvars(ASTContext *Ctx,
Fields.push_back(cast<FieldDecl>(IVDecl));
}
// look into properties.
- for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*Ctx),
- E = OI->prop_end(*Ctx); I != E; ++I) {
+ for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*this),
+ E = OI->prop_end(*this); I != E; ++I) {
if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
Fields.push_back(cast<FieldDecl>(IV));
}
}
-
-void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI,
- llvm::SmallVectorImpl<FieldDecl*> &Fields) {
- if (const ObjCInterfaceDecl *SuperClass = OI->getSuperClass())
- CollectObjCIvars(SuperClass, Fields);
- CollectLocalObjCIvars(this, OI, Fields);
-}
-
/// addRecordToClass - produces record info. for the class for its
/// ivars and all those inherited.
///
const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D) {
// FIXME: The only client relying on this working in the presence of
- // forward declarations is CodeGenTypes in IRgen, which should not
- // need it. Fix and simplify this code.
+ // forward declarations is IRgen, which should not need it. Fix
+ // and simplify this code.
RecordDecl *&RD = ASTRecordForInterface[D];
if (RD) {
// If we have a record decl already and it is either a definition or if 'D'
@@ -668,28 +662,11 @@ const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D) {
D->getIdentifier());
llvm::SmallVector<FieldDecl*, 32> RecFields;
- CollectLocalObjCIvars(this, D, RecFields);
+ CollectObjCIvars(D, RecFields);
if (RD == 0)
RD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, D->getLocation(),
D->getIdentifier());
-
-
- const RecordDecl *SRD;
- if (const ObjCInterfaceDecl *SuperClass = D->getSuperClass()) {
- SRD = addRecordToClass(SuperClass);
- } else {
- SRD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, SourceLocation(), 0);
- const_cast<RecordDecl*>(SRD)->completeDefinition(*this);
- }
-
- RD->addDecl(*this,
- FieldDecl::Create(*this, RD,
- SourceLocation(),
- 0,
- getTagDeclType(const_cast<RecordDecl*>(SRD)),
- 0, false));
-
/// FIXME! Can do collection of ivars and adding to the record while
/// doing it.
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {