[PATCH] D64083: [OpenCL][Sema] Improve address space support for blocks
Marco Antognini via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 08:05:30 PDT 2019
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64083.208683.patch
Type: text/x-patch
Size: 1191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190709/166968ed/attachment.bin>
More information about the cfe-commits
mailing list