diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-22 10:56:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-22 10:56:29 +0000 |
commit | 75da6744de692c60e824c02b096aa84dfd993364 (patch) | |
tree | 9ea0cfbb15ee8831d45cdd0cafe3844e166d0b45 /lib/AST/ASTContext.cpp | |
parent | 412f59b23fc502b199b9ca96c72ef5d5ad21d62b (diff) |
Simplify addRecordToClass, it is not legal to call it on a forward
declaration now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 1e553e3aba..d91a8cefd1 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -644,29 +644,20 @@ void ASTContext::CollectObjCIvars(const ObjCInterfaceDecl *OI, /// ivars and all those inherited. /// const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D) { + assert(!D->isForwardDecl() && "Invalid decl!"); + // FIXME: The only client relying on this working in the presence of // 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' - // is still a forward declaration, return it. - if (RD->isDefinition() || D->isForwardDecl()) - return RD; - } - - // If D is a forward declaration, then just make a forward struct decl. - if (D->isForwardDecl()) - return RD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, - D->getLocation(), - D->getIdentifier()); + if (RD) + return RD; llvm::SmallVector<FieldDecl*, 32> RecFields; CollectObjCIvars(D, RecFields); - if (RD == 0) - RD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, D->getLocation(), - D->getIdentifier()); + RD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, D->getLocation(), + D->getIdentifier()); /// FIXME! Can do collection of ivars and adding to the record while /// doing it. for (unsigned i = 0, e = RecFields.size(); i != e; ++i) { |