[PATCH] D32856: [OpenCL] Check that global samplers are const
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 5 06:59:52 PDT 2017
yaxunl 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 ||
----------------
svenvh wrote:
> 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.
On second thoughts, let's keep it as it is.
Can you add tests for
const sampler_t
const constant sampler_t
const global sampler_t
Thanks.
https://reviews.llvm.org/D32856
More information about the cfe-commits
mailing list