Details
- Reviewers
bader
Diff Detail
Event Timeline
test/SemaOpenCL/half.cl | ||
---|---|---|
29 | It's not related to your change, but it looks like there are two checks that report the same error. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
7599–7602 | It looks strange to me. First we check if parameter type is half - we set InvalidKernelParam status, later we check again and do not report an error. I think the whole patch should two deleted lines from getOpenCLKernelParameterType function + test case. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
7599–7602 | getOpenCLKernelParameterType should report half type as InvalidKernelParam since it really is an invalid kernel argument type. We do not emit diagnostic msg because the msg is redundant, not because half type is a valid kernel argument type. getOpenCLKernelParameterType may be used for other purpose. Reporting half type as a valid kernel argument violates the semantics of getOpenCLKernelParameterType and can cause confusion and potential error. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
7600 | -> elsewhere |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
7599–7602 | Maybe we should the other way. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
7599–7602 | Clang can emit two error msgs in this case since it does two independent checks:
I think error msg 1 is better than error msg 2 since error msg 1 provides more information, i.e., when cl_khr_fp16 is disabled, half type cannot be used as either kernel function argument or non-kernel function argument, whereas error msg 2 may give user the wrong impression that half type can not be used for kernel function argument only. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
7600 | I will fix it in commit. |
-> elsewhere