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

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 11:03:38 PDT 2017


Anastasia 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">;
----------------
echuraev wrote:
> 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.
Ah yes! Sorry, I got confused by the absence of opencl in the neighboring diagnostics. :)


================
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}}
----------------
echuraev wrote:
> 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//
But there is an error now given for the call to 'work_group_reserve_read_pipe'. Why is it still added to the declarations? I think we should prevent this.


https://reviews.llvm.org/D31745





More information about the cfe-commits mailing list