forked from OSchip/llvm-project
Always start tag definitions before completing them. Assert same.
Fixes latent and not-so-latent objc++ and blocks++ bugs. llvm-svn: 95340
This commit is contained in:
parent
3b245876c0
commit
ae580fede3
|
@ -2902,6 +2902,7 @@ QualType ASTContext::getCFConstantStringType() {
|
|||
CFConstantStringTypeDecl =
|
||||
CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
|
||||
&Idents.get("NSConstantString"));
|
||||
CFConstantStringTypeDecl->startDefinition();
|
||||
|
||||
QualType FieldTypes[4];
|
||||
|
||||
|
@ -2941,6 +2942,7 @@ QualType ASTContext::getObjCFastEnumerationStateType() {
|
|||
ObjCFastEnumerationStateTypeDecl =
|
||||
CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
|
||||
&Idents.get("__objcFastEnumerationState"));
|
||||
ObjCFastEnumerationStateTypeDecl->startDefinition();
|
||||
|
||||
QualType FieldTypes[] = {
|
||||
UnsignedLongTy,
|
||||
|
@ -2974,6 +2976,7 @@ QualType ASTContext::getBlockDescriptorType() {
|
|||
// FIXME: Needs the FlagAppleBlock bit.
|
||||
T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
|
||||
&Idents.get("__block_descriptor"));
|
||||
T->startDefinition();
|
||||
|
||||
QualType FieldTypes[] = {
|
||||
UnsignedLongTy,
|
||||
|
@ -3017,6 +3020,7 @@ QualType ASTContext::getBlockDescriptorExtendedType() {
|
|||
// FIXME: Needs the FlagAppleBlock bit.
|
||||
T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
|
||||
&Idents.get("__block_descriptor_withcopydispose"));
|
||||
T->startDefinition();
|
||||
|
||||
QualType FieldTypes[] = {
|
||||
UnsignedLongTy,
|
||||
|
@ -3137,6 +3141,7 @@ QualType ASTContext::getBlockParmType(
|
|||
RecordDecl *T;
|
||||
T = CreateRecordDecl(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
|
||||
&Idents.get(Name.str()));
|
||||
T->startDefinition();
|
||||
QualType FieldTypes[] = {
|
||||
getPointerType(VoidPtrTy),
|
||||
IntTy,
|
||||
|
|
|
@ -1386,6 +1386,10 @@ void TagDecl::startDefinition() {
|
|||
}
|
||||
|
||||
void TagDecl::completeDefinition() {
|
||||
assert((!isa<CXXRecordDecl>(this) ||
|
||||
cast<CXXRecordDecl>(this)->hasDefinition()) &&
|
||||
"definition completed but not started");
|
||||
|
||||
IsDefinition = true;
|
||||
if (TagType *TagT = const_cast<TagType *>(TypeForDecl->getAs<TagType>())) {
|
||||
assert(TagT->decl.getPointer() == this &&
|
||||
|
|
|
@ -410,8 +410,8 @@ const llvm::Type *CodeGenTypes::ConvertTagDeclType(const TagDecl *TD) {
|
|||
if (TDTI != TagDeclTypes.end())
|
||||
return TDTI->second;
|
||||
|
||||
// If this is still a forward definition, just define an opaque type to use
|
||||
// for this tagged decl.
|
||||
// If this is still a forward declaration, just define an opaque
|
||||
// type to use for this tagged decl.
|
||||
if (!TD->isDefinition()) {
|
||||
llvm::Type *ResultType = llvm::OpaqueType::get(getLLVMContext());
|
||||
TagDeclTypes.insert(std::make_pair(Key, ResultType));
|
||||
|
|
Loading…
Reference in New Issue