[PATCH] D59646: [PR40778][PR41157][OpenCL] Prevent implicit initialization of local address space objects
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 26 12:26:12 PDT 2019
rjmccall added inline comments.
================
Comment at: lib/Sema/SemaDecl.cpp:11648-11651
+ // In OpenCL we don't allow to initialize objects in local address space.
+ if (getLangOpts().OpenCL &&
+ Var->getType().getAddressSpace() == LangAS::opencl_local)
+ return;
----------------
Anastasia wrote:
> bader wrote:
> > Shouldn't we invalidate Var declaration?
> This early exit is to prevent adding default initializer implicitly to the declarations that are valid.
"In OpenCL, we can't initialize objects in the __local address space, even implicitly, so don't synthesize an implicit initializer."
I think it's important to add the underscores on `__local` to make it obvious that we're talking about OpenCL's "local" address space, not the address space that local variables appear in.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59646/new/
https://reviews.llvm.org/D59646
More information about the cfe-commits
mailing list