which consequently caused a Seg fault. during meta-data
generation. It also addresses an issue related to
late binding of newly synthesize ivars (when we support it).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64563
91177308-0d34-0410-b5e6-
96231b3b80d8
/// specified typename decl.
QualType getTypedefType(TypedefDecl *Decl);
QualType getObjCInterfaceType(ObjCInterfaceDecl *Decl);
+ QualType buildObjCInterfaceType(ObjCInterfaceDecl *Decl);
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index,
IdentifierInfo *Name = 0);
return QualType(Decl->TypeForDecl, 0);
}
+/// buildObjCInterfaceType - Returns a new type for the interface
+/// declaration, regardless. It also removes any previously built
+/// record declaration so caller can rebuild it.
+QualType ASTContext::buildObjCInterfaceType(ObjCInterfaceDecl *Decl) {
+ const RecordDecl *&RD = ASTRecordForInterface[Decl];
+ if (RD)
+ RD = 0;
+ Decl->TypeForDecl = new(*this,8) ObjCInterfaceType(Type::ObjCInterface, Decl);
+ Types.push_back(Decl->TypeForDecl);
+ return QualType(Decl->TypeForDecl, 0);
+}
+
/// \brief Retrieve the template type parameter type for a template
/// parameter with the given depth, index, and (optionally) name.
QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index,
Interface->protocol_begin(),
Interface->protocol_end());
const llvm::Type *InterfaceTy =
- CGM.getTypes().ConvertType(CGM.getContext().getObjCInterfaceType(Interface));
+ CGM.getTypes().ConvertType(CGM.getContext().buildObjCInterfaceType(Interface));
unsigned Flags = eClassFlags_Factory;
unsigned Size = CGM.getTargetData().getTypePaddedSize(InterfaceTy);
const_cast<ObjCInterfaceDecl*>(ID->getClassInterface())) {
// FIXME. Share this with the one in EmitIvarList.
const llvm::Type *InterfaceTy =
- CGM.getTypes().ConvertType(CGM.getContext().getObjCInterfaceType(OID));
+ CGM.getTypes().ConvertType(CGM.getContext().buildObjCInterfaceType(OID));
const llvm::StructLayout *Layout =
CGM.getTargetData().getStructLayout(cast<llvm::StructType>(InterfaceTy));
--- /dev/null
+// RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s
+
+@interface I0 {
+ struct { int a; } a;
+}
+@end
+
+@class I2;
+
+@interface I1 {
+ I2 *_imageBrowser;
+}
+@end
+
+@implementation I1
+@end
+
+@interface I2 : I0
+@end
+
+@implementation I2
+@end
+
+