diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2017-06-01 18:41:25 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-06-01 18:41:25 +0000 |
commit | 14149bfa410078fe5260db0b95f7d3d6c86694bd (patch) | |
tree | 559c8e001130f9ce139b8fa64c4c6870b5008157 /clang/test/CodeGenObjC/parameterized_classes.m | |
parent | c1d26062f7bfdc357bd05598a4b92cddc23a0fa5 (diff) | |
download | bcm5719-llvm-14149bfa410078fe5260db0b95f7d3d6c86694bd.tar.gz bcm5719-llvm-14149bfa410078fe5260db0b95f7d3d6c86694bd.zip |
[CodeGen][ObjC] Fix assertion failure in EmitARCStoreStrongCall.
The assertion fails because EmitValueForIvarAtOffset doesn't get the
correct type of the ivar when the class the ivar belongs to is
parameterized. This commit fixes the function to compute the ivar's type
based on the type argument provided to the parameterized class.
rdar://problem/32461723
Differential Revision: https://reviews.llvm.org/D33698
llvm-svn: 304449
Diffstat (limited to 'clang/test/CodeGenObjC/parameterized_classes.m')
-rw-r--r-- | clang/test/CodeGenObjC/parameterized_classes.m | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/parameterized_classes.m b/clang/test/CodeGenObjC/parameterized_classes.m index b75cf2e3ad2..8fe5c52b8d3 100644 --- a/clang/test/CodeGenObjC/parameterized_classes.m +++ b/clang/test/CodeGenObjC/parameterized_classes.m @@ -68,3 +68,31 @@ void blockTest(NSMutableArray<void (^)(void)> *array, NSString *name) { // CHECK: call i8* @objc_retainBlock // CHECK: ret void } + +// CHECK-LABEL: define internal void @"\01-[Derived setDest:] +// CHECK: %[[SELFADDR:.*]] = alloca %[[SELFTY:.*]]* +// CHECK: %[[AADDR:.*]] = alloca %[[IVARTY:.*]]* +// CHECK: %[[V2:.*]] = load %[[IVARTY]]*, %[[IVARTY]]** %[[AADDR]] +// CHECK: %[[V3:.*]] = load %[[SELFTY]]*, %[[SELFTY]]** %[[SELFADDR]] +// CHECK: %[[IVAR:.*]] = load i64, i64* @"OBJC_IVAR_$_Base._destination" +// CHECK: %[[V4:.*]] = bitcast %[[SELFTY]]* %[[V3]] to i8* +// CHECK: %[[ADDPTR:.*]] = getelementptr inbounds i8, i8* %[[V4]], i64 %[[IVAR]] +// CHECK: %[[V5:.*]] = bitcast i8* %[[ADDPTR]] to %[[IVARTY]]** +// CHECK: %[[V6:.*]] = bitcast %[[IVARTY]]** %[[V5]] to i8** +// CHECK: %[[V7:.*]] = bitcast %[[IVARTY]]* %[[V2]] to i8* +// CHECK: call void @objc_storeStrong(i8** %[[V6]], i8* %[[V7]]) + +@interface Base<DestType> : NSObject { + DestType _destination; +} +@end + +@interface Derived : Base<NSObject *> +- (void)setDest:(NSObject *)a; +@end + +@implementation Derived +- (void)setDest:(NSObject *)a { + _destination = a; +} +@end |