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

Sven van Haastregt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 04:48:42 PDT 2017


svenvh marked an inline comment as done.
svenvh added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:6085
+      // space qualifier or with the const qualifier.
+      if (DC->isTranslationUnit() &&
+          !(R.getAddressSpace() == LangAS::opencl_constant ||
----------------
yaxunl wrote:
> should be else if ?
> 
> if the previous error already happens, it is unnecessary to do the next check

Sure, I can do that, I am just not sure what the desirable behaviour is here?  They are different errors, so with the current patch it emits both diagnostics (see the first test change).  If we just want one diagnostic (the first one in that test case), I can change it to else if; please let me know if you prefer that.


https://reviews.llvm.org/D32856





More information about the cfe-commits mailing list