[PATCH] D31745: [OpenCL] Added diagnostic for implicit declaration of function in OpenCL

Egor Churaev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 11:05:52 PDT 2017


echuraev added inline comments.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8254
   "%0 cannot be used as the type of a kernel parameter">;
+def err_opencl_implicit_function_decl : Error<
+  "implicit declaration of function %0 is invalid in OpenCL">;
----------------
Anastasia wrote:
> Could this be in OpenCL group please?
But this is already in OpenCL group. Please, see line 8232. In this line is a comment that OpenCL warnings and errors are below.


================
Comment at: test/SemaOpenCL/clang-builtin-version.cl:32
+  work_group_reserve_write_pipe(tmp, tmp); // expected-error{{implicit declaration of function 'work_group_reserve_write_pipe' is invalid in OpenCL}}
+  // expected-note at -1{{did you mean 'work_group_reserve_read_pipe'?}}
+  // expected-note at -2{{'work_group_reserve_write_pipe' declared here}}
----------------
Anastasia wrote:
> Why do we get this note now? I believe work_group_reserve_read_pipe shouldn't be available either?
May be I don't understand something but I think that it is the right diagnostic message. We called work_group_reserve_read_pipe in line 29. So for this case we will get the following message: 
//clang-builtin-version.cl: 31 error: implicit declaration of function 'work_group_reserve_write_pipe' is invalid in OpenCL
clang-builtin-version.cl: 31 note: did you mean 'work_group_reserve_read_pipe'?
clang-builtin-version.cl: 29 note: 'work_group_reserve_read_pipe' declared here//


https://reviews.llvm.org/D31745





More information about the cfe-commits mailing list