Anastasia added a comment.

In https://reviews.llvm.org/D23086#516741, @yaxunl wrote:

> 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.


Right. I am wondering if in C++ use cases, that David have mentioned, they 
already handle this.

@majnemer, do you have any solution for this issue in your use cases? Checking 
for the name of the type seems to be unsafe in case of custom typedefs creating 
aliases of the same type with different names? Also forcing the structure in 
Clang is undesirable for us because vendors might have different (more 
suitable) implementations of the type.


Repository:
  rL LLVM

https://reviews.llvm.org/D23086



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to