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/lib/CodeGen | |
| 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/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGObjCRuntime.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp index 3e3d0467235..b5599dad309 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -90,7 +90,11 @@ LValue CGObjCRuntime::EmitValueForIvarAtOffset(CodeGen::CodeGenFunction &CGF, unsigned CVRQualifiers, llvm::Value *Offset) { // Compute (type*) ( (char *) BaseValue + Offset) - QualType IvarTy = Ivar->getType().withCVRQualifiers(CVRQualifiers); + QualType InterfaceTy{OID->getTypeForDecl(), 0}; + QualType ObjectPtrTy = + CGF.CGM.getContext().getObjCObjectPointerType(InterfaceTy); + QualType IvarTy = + Ivar->getUsageType(ObjectPtrTy).withCVRQualifiers(CVRQualifiers); llvm::Type *LTy = CGF.CGM.getTypes().ConvertTypeForMem(IvarTy); llvm::Value *V = CGF.Builder.CreateBitCast(BaseValue, CGF.Int8PtrTy); V = CGF.Builder.CreateInBoundsGEP(V, Offset, "add.ptr"); |

