[clang] [ObjC] Check entire chain of superclasses to see if class layout can be statically known (PR #81335)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 22 13:36:12 PST 2024
================
@@ -17,9 +23,71 @@ @implementation StaticLayout {
-(void)meth {
static_layout_ivar = 0;
// CHECK-NOT: load i64, ptr @"OBJC_IVAR_$_StaticLayout
+ // CHECK: getelementptr inbounds i8, ptr %0, i64 20
}
@end
+// Ivars declared in the @interface
+ at interface SuperClass : NSObject
+ at property (nonatomic, assign) int superClassProperty;
+ at end
+
+ at implementation SuperClass {
+ int superClassIvar; // Declare an ivar
+}
+- (void)superClassMethod {
+ _superClassProperty = 42;
+ superClassIvar = 10;
+ // CHECK-NOT: load i64, ptr @"OBJC_IVAR_$_SuperClass
----------------
rjmccall wrote:
Please add CHECK-LABEL lines for the `define` lines for each of the method definitions containing these ivar accesses. You can look at test/CodeGenObjC/direct-methods.m for the pattern I'm looking for here.
https://github.com/llvm/llvm-project/pull/81335
More information about the cfe-commits
mailing list