[PATCH] D32856: [OpenCL] Check that global samplers are const

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 4 08:07:21 PDT 2017


yaxunl added inline comments.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8301
+def err_opencl_sampler_qualifier : Error<
+  "global sampler requires a const qualifier">;
 def err_opencl_cast_non_zero_to_event_t : Error<
----------------
global sampler requires a const or constant address space qualifier


================
Comment at: lib/Sema/SemaDecl.cpp:6085
+      // space qualifier or with the const qualifier.
+      if (DC->isTranslationUnit() &&
+          !(R.getAddressSpace() == LangAS::opencl_constant ||
----------------
should be else if ?

if the previous error already happens, it is unnecessary to do the next check


https://reviews.llvm.org/D32856





More information about the cfe-commits mailing list