This repository was archived by the owner on Nov 1, 2021. It is now read-only.
File tree 4 files changed +39
-2
lines changed
4 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ class ASTContext {
263
263
// / specified typename decl.
264
264
QualType getTypedefType (TypedefDecl *Decl);
265
265
QualType getObjCInterfaceType (ObjCInterfaceDecl *Decl);
266
+ QualType buildObjCInterfaceType (ObjCInterfaceDecl *Decl);
266
267
267
268
QualType getTemplateTypeParmType (unsigned Depth, unsigned Index,
268
269
IdentifierInfo *Name = 0 );
Original file line number Diff line number Diff line change @@ -1210,6 +1210,18 @@ QualType ASTContext::getObjCInterfaceType(ObjCInterfaceDecl *Decl) {
1210
1210
return QualType (Decl->TypeForDecl , 0 );
1211
1211
}
1212
1212
1213
+ // / buildObjCInterfaceType - Returns a new type for the interface
1214
+ // / declaration, regardless. It also removes any previously built
1215
+ // / record declaration so caller can rebuild it.
1216
+ QualType ASTContext::buildObjCInterfaceType (ObjCInterfaceDecl *Decl) {
1217
+ const RecordDecl *&RD = ASTRecordForInterface[Decl];
1218
+ if (RD)
1219
+ RD = 0 ;
1220
+ Decl->TypeForDecl = new (*this ,8 ) ObjCInterfaceType (Type::ObjCInterface, Decl);
1221
+ Types.push_back (Decl->TypeForDecl );
1222
+ return QualType (Decl->TypeForDecl , 0 );
1223
+ }
1224
+
1213
1225
// / \brief Retrieve the template type parameter type for a template
1214
1226
// / parameter with the given depth, index, and (optionally) name.
1215
1227
QualType ASTContext::getTemplateTypeParmType (unsigned Depth, unsigned Index,
Original file line number Diff line number Diff line change @@ -1370,7 +1370,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
1370
1370
Interface->protocol_begin (),
1371
1371
Interface->protocol_end ());
1372
1372
const llvm::Type *InterfaceTy =
1373
- CGM.getTypes ().ConvertType (CGM.getContext ().getObjCInterfaceType (Interface));
1373
+ CGM.getTypes ().ConvertType (CGM.getContext ().buildObjCInterfaceType (Interface));
1374
1374
unsigned Flags = eClassFlags_Factory;
1375
1375
unsigned Size = CGM.getTargetData ().getTypePaddedSize (InterfaceTy);
1376
1376
@@ -3717,7 +3717,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) {
3717
3717
const_cast <ObjCInterfaceDecl*>(ID->getClassInterface ())) {
3718
3718
// FIXME. Share this with the one in EmitIvarList.
3719
3719
const llvm::Type *InterfaceTy =
3720
- CGM.getTypes ().ConvertType (CGM.getContext ().getObjCInterfaceType (OID));
3720
+ CGM.getTypes ().ConvertType (CGM.getContext ().buildObjCInterfaceType (OID));
3721
3721
const llvm::StructLayout *Layout =
3722
3722
CGM.getTargetData ().getStructLayout (cast<llvm::StructType>(InterfaceTy));
3723
3723
Original file line number Diff line number Diff line change
1
+ // RUN: clang -triple x86_64-unknown-unknown -emit-llvm -o %t %s
2
+
3
+ @interface I0 {
4
+ struct { int a; } a;
5
+ }
6
+ @end
7
+
8
+ @class I2;
9
+
10
+ @interface I1 {
11
+ I2 *_imageBrowser;
12
+ }
13
+ @end
14
+
15
+ @implementation I1
16
+ @end
17
+
18
+ @interface I2 : I0
19
+ @end
20
+
21
+ @implementation I2
22
+ @end
23
+
24
+
You can’t perform that action at this time.
0 commit comments