From: Daniel Dunbar Date: Sun, 3 May 2009 14:27:48 +0000 (+0000) Subject: Remove ASTContext::addRecordToClass. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee1ec39f54a759a1c0858b608e02d70e0d7f54bc;p=clang Remove ASTContext::addRecordToClass. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70780 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 18ea40b1e9..4c80baa2c8 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -97,10 +97,6 @@ class ASTContext { llvm::DenseMap SignedFixedWidthIntTypes; llvm::DenseMap UnsignedFixedWidthIntTypes; - - // FIXME: ASTRecordForInterface/ASTFieldForIvarRef and addRecordToClass and - // getFieldDecl be part of the backend (i.e. CodeGenTypes)? - llvm::DenseMap ASTRecordForInterface; /// BuiltinVaListType - built-in va list type. /// This is initially null and set by Sema::LazilyCreateBuiltin when @@ -539,7 +535,6 @@ public: const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D); - const RecordDecl *addRecordToClass(const ObjCInterfaceDecl *D); void CollectObjCIvars(const ObjCInterfaceDecl *OI, llvm::SmallVectorImpl &Fields); diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h index a8b49fb2df..c68edfaf71 100644 --- a/include/clang/AST/RecordLayout.h +++ b/include/clang/AST/RecordLayout.h @@ -24,7 +24,7 @@ namespace clang { /// This class contains layout information for one RecordDecl, /// which is a struct/union/class. The decl represented must be a definition, /// not a forward declaration. -/// This class is also used to contain layout informaiton for one +/// This class is also used to contain layout information for one /// ObjCInterfaceDecl. FIXME - Find appropriate name. /// These objects are managed by ASTContext. class ASTRecordLayout { diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index ac70cef499..0ef672768d 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -71,15 +71,6 @@ ASTContext::~ASTContext() { } } - { - llvm::DenseMap::iterator - I = ASTRecordForInterface.begin(), E = ASTRecordForInterface.end(); - while (I != E) { - RecordDecl *R = (I++)->second; - R->Destroy(*this); - } - } - // Destroy nested-name-specifiers. for (llvm::FoldingSet::iterator NNS = NestedNameSpecifiers.begin(), @@ -676,7 +667,10 @@ static void CollectLocalObjCIvars(ASTContext *Ctx, if (!IVDecl->isInvalidDecl()) Fields.push_back(cast(IVDecl)); } - // look into properties. + // Look into properties. + // + // FIXME: This needs to go away, synthesized ivars shouldn't be + // accessible from the interface decl. for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*Ctx), E = OI->prop_end(*Ctx); I != E; ++I) { if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl()) @@ -691,51 +685,6 @@ void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI, 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) { - assert(!D->isForwardDecl() && "Invalid decl!"); - - RecordDecl *&RD = ASTRecordForInterface[D]; - if (RD) - return RD; - - llvm::SmallVector RecFields; - CollectLocalObjCIvars(this, D, RecFields); - - 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(SRD)->completeDefinition(*this); - } - - RD->addDecl(*this, - FieldDecl::Create(*this, RD, - SourceLocation(), - 0, - getTagDeclType(const_cast(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) { - RD->addDecl(*this, - FieldDecl::Create(*this, RD, - RecFields[i]->getLocation(), - RecFields[i]->getIdentifier(), - RecFields[i]->getType(), - RecFields[i]->getBitWidth(), false)); - } - - RD->completeDefinition(*this); - return RD; -} - /// getInterfaceLayoutImpl - Get or compute information about the /// layout of the given interface. ///