[PATCH] D23086: [OpenCL] Generate concrete struct type for ndrange_t

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 08:59:31 PDT 2016


yaxunl added a comment.

In https://reviews.llvm.org/D23086#516365, @Anastasia wrote:

> Why not to just identify the type by the name? It seems much easier and also gives flexibility to implement the type in different ways if needed. Considering that similar approach is already used for some C++ types, it should be fine.


This does not work. For example, user could define

  typedef ndrange_t my_ndrange_t;

and pass a variable X of type my_ndrange_t to enqueue_kernel. If we identify ndrange_t by type name, X would be identified as not an ndrange_t type and an error will be emitted, which is wrong. Therefore we have to check the canonical type.


Repository:
  rL LLVM

https://reviews.llvm.org/D23086





More information about the cfe-commits mailing list