[PATCH] D52598: [OpenCL] Fixed address space cast in C style cast of C++ parsing
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 2 10:27:15 PDT 2018
Anastasia 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
----------------
rjmccall wrote:
> Why is this not a method on `CastOperation`?
Will change!
================
Comment at: lib/Sema/SemaCast.cpp:2288
+ SrcType->isPointerType()) {
+ const PointerType *DestPtr = DestType->getAs<PointerType>();
+ if (!DestPtr->isAddressSpaceOverlapping(*SrcType->getAs<PointerType>())) {
----------------
rjmccall wrote:
> Please test the result of `getAs` instead of separately testing `isPointerType`.
>
> Why is this check OpenCL-specific? Address spaces are a general language feature.
I think mainly because I am factoring out from the existing OpenCL check. But it probably makes sense that the semantics of this is not different in other languages. I will update it! Thanks!
https://reviews.llvm.org/D52598
More information about the cfe-commits
mailing list