This revision was automatically updated to reflect the committed changes. Closed by commit rL365500: [OpenCL][Sema] Improve address space support for blocks (authored by mantognini, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D64083?vs=207573&id=208683#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64083/new/ https://reviews.llvm.org/D64083 Files: cfe/trunk/lib/Sema/SemaExprCXX.cpp Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -4216,7 +4216,20 @@ break; case ICK_Block_Pointer_Conversion: { - From = ImpCastExprToType(From, ToType.getUnqualifiedType(), CK_BitCast, + QualType LHSType = Context.getCanonicalType(ToType).getUnqualifiedType(); + QualType RHSType = Context.getCanonicalType(FromType).getUnqualifiedType(); + + // Assumptions based on Sema::IsBlockPointerConversion. + assert(isa<BlockPointerType>(LHSType) && "BlockPointerType expected"); + assert(isa<BlockPointerType>(RHSType) && "BlockPointerType expected"); + + LangAS AddrSpaceL = + LHSType->getAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + LangAS AddrSpaceR = + RHSType->getAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + CastKind Kind = + AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast; + From = ImpCastExprToType(From, ToType.getUnqualifiedType(), Kind, VK_RValue, /*BasePath=*/nullptr, CCK).get(); break; }
Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -4216,7 +4216,20 @@ break; case ICK_Block_Pointer_Conversion: { - From = ImpCastExprToType(From, ToType.getUnqualifiedType(), CK_BitCast, + QualType LHSType = Context.getCanonicalType(ToType).getUnqualifiedType(); + QualType RHSType = Context.getCanonicalType(FromType).getUnqualifiedType(); + + // Assumptions based on Sema::IsBlockPointerConversion. + assert(isa<BlockPointerType>(LHSType) && "BlockPointerType expected"); + assert(isa<BlockPointerType>(RHSType) && "BlockPointerType expected"); + + LangAS AddrSpaceL = + LHSType->getAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + LangAS AddrSpaceR = + RHSType->getAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + CastKind Kind = + AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast; + From = ImpCastExprToType(From, ToType.getUnqualifiedType(), Kind, VK_RValue, /*BasePath=*/nullptr, CCK).get(); break; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits