File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -1593,12 +1593,19 @@ class CGObjCNonFragileABIMac : public CGObjCCommonMac {
1593
1593
}
1594
1594
1595
1595
bool isClassLayoutKnownStatically (const ObjCInterfaceDecl *ID) {
1596
+ if (!ID)
1597
+ return false ;
1598
+
1599
+ if (ID->getName () == " NSObject" )
1600
+ return true ;
1601
+
1596
1602
// NSObject is a fixed size. If we can see the @implementation of a class
1597
- // which inherits from NSObject then we know that all it's offsets also must
1598
- // be fixed. FIXME: Can we do this if see a chain of super classes with
1599
- // implementations leading to NSObject?
1600
- return ID->getImplementation () && ID->getSuperClass () &&
1601
- ID->getSuperClass ()->getName () == " NSObject" ;
1603
+ // which inherits from NSObject, then we know that all its offsets must
1604
+ // be fixed.
1605
+
1606
+ // Check recursively for all intermediate superclasses.
1607
+ return ID->getImplementation () &&
1608
+ isClassLayoutKnownStatically (ID->getSuperClass ());
1602
1609
}
1603
1610
1604
1611
public:
Original file line number Diff line number Diff line change 1
1
// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 -emit-llvm %s -o - | FileCheck %s
2
2
3
3
// CHECK: @"OBJC_IVAR_$_StaticLayout.static_layout_ivar" = hidden constant i64 20
4
- // CHECK: @"OBJC_IVAR_$_StaticLayoutSubClass.static_layout_ivar2" = hidden global i64 24
4
+ // CHECK: @"OBJC_IVAR_$_StaticLayoutSubClass.static_layout_ivar2" = hidden constant i64 24
5
5
// CHECK: @"OBJC_IVAR_$_NotStaticLayout.not_static_layout_ivar" = hidden global i64 12
6
6
7
7
@interface NSObject {
@@ -29,7 +29,7 @@ @implementation StaticLayoutSubClass {
29
29
}
30
30
-(void )meth2 {
31
31
static_layout_ivar2 = 0 ;
32
- // CHECK: load i64, ptr @"OBJC_IVAR_$_StaticLayoutSubClass
32
+ // CHECK-NOT : load i64, ptr @"OBJC_IVAR_$_StaticLayoutSubClass
33
33
}
34
34
@end
35
35
You can’t perform that action at this time.
0 commit comments