[PATCH] D52598: [OpenCL] Fixed address space cast in C style cast of C++ parsing
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 1 11:34:09 PDT 2018
rjmccall added inline comments.
================
Comment at: lib/Sema/SemaCast.cpp:2283
+ const QualType &SrcType,
+ const QualType &DestType) {
+ // OpenCL v1 s6.5: Casting a pointer to address space A to a pointer to
----------------
Why is this not a method on `CastOperation`?
================
Comment at: lib/Sema/SemaCast.cpp:2288
+ SrcType->isPointerType()) {
+ const PointerType *DestPtr = DestType->getAs<PointerType>();
+ if (!DestPtr->isAddressSpaceOverlapping(*SrcType->getAs<PointerType>())) {
----------------
Please test the result of `getAs` instead of separately testing `isPointerType`.
Why is this check OpenCL-specific? Address spaces are a general language feature.
https://reviews.llvm.org/D52598
More information about the cfe-commits
mailing list