[PATCH] D70605: [OpenCL] Fix address space for implicit conversion (PR43145)

Bevin Hansson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 7 09:08:53 PDT 2020


ebevhan added a comment.

I know this is some really late feedback on this patch. I struck upon some issues with while rebasing D62574 <https://reviews.llvm.org/D62574>.



================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:4106
+      NewToType = Context.getAddrSpaceQualType(NewToType,
+                                               FromPteeType.getAddressSpace());
+      if (ToType->isObjCObjectPointerType())
----------------
I don't think this will manage to properly repack the type if it's hidden behind enough sugar. When I enable C++ address space conversions in a non-OpenCL context, this breaks the derived-to-base example in CodeGenCXX/address-space-cast.cpp.

IsPointerConversion doesn't have an issue with this since it reconstructs the destination type with the appropriate qualifiers through BuildSimilarlyQualifiedPointerType.

Wouldn't it make more sense to have *PointerConversion only handle the derived-to-base and leave the address space conversion to *QualificationConversion?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70605/new/

https://reviews.llvm.org/D70605





More information about the cfe-commits mailing list