[PATCH] D64804: [OpenCL][Sema] Minor refactoring and constraint checking

Marco Antognini via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 01:53:26 PDT 2019


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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64804.210269.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190717/627088ea/attachment.bin>


More information about the cfe-commits mailing list