[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 May 15 09:56:53 PDT 2017


Anastasia added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:12449
   // function declaration is going to be treated as an error.
-  if (Diags.getDiagnosticLevel(diag_id, Loc) >= DiagnosticsEngine::Error) {
+  if (!getLangOpts().OpenCL &&
+      Diags.getDiagnosticLevel(diag_id, Loc) >= DiagnosticsEngine::Error) {
----------------
This way prevents the typo corrections completely for OpenCL which is not very desirable. I was just wondering could we prevent adding the invalid builtin function identifiers instead to the correction candidate list.

Like when `work_group_reserve_read_pipe` was first parsed it shouldn't have been added to the list of valid function identifiers to appear in the corrections of  'work_group_reserve_write_pipe'. I am guessing the identifier might be added when builtins are initialized...


https://reviews.llvm.org/D31745





More information about the cfe-commits mailing list