This revision was automatically updated to reflect the committed changes. Closed by commit rL366306: [OpenCL][Sema] Minor refactoring and constraint checking (authored by mantognini, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D64804?vs=210115&id=210269#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64804/new/ https://reviews.llvm.org/D64804 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,17 +4216,12 @@ break; case ICK_Block_Pointer_Conversion: { - 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(); + ToType->castAs<BlockPointerType>()->getPointeeType().getAddressSpace(); LangAS AddrSpaceR = - RHSType->getAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + FromType->castAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + assert(Qualifiers::isAddressSpaceSupersetOf(AddrSpaceL, AddrSpaceR) && + "Invalid cast"); CastKind Kind = AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast; From = ImpCastExprToType(From, ToType.getUnqualifiedType(), Kind,
Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -4216,17 +4216,12 @@ break; case ICK_Block_Pointer_Conversion: { - 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(); + ToType->castAs<BlockPointerType>()->getPointeeType().getAddressSpace(); LangAS AddrSpaceR = - RHSType->getAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + FromType->castAs<BlockPointerType>()->getPointeeType().getAddressSpace(); + assert(Qualifiers::isAddressSpaceSupersetOf(AddrSpaceL, AddrSpaceR) && + "Invalid cast"); CastKind Kind = AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast; From = ImpCastExprToType(From, ToType.getUnqualifiedType(), Kind,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits