[PATCH] D46022: [OpenCL] Restrict various keywords in OpenCL C++ mode

Sven van Haastregt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 30 10:18:09 PDT 2018


svenvh added inline comments.


================
Comment at: lib/Parse/ParseStmtAsm.cpp:696
+    return StmtError();
+  }
+
----------------
rjmccall wrote:
> svenvh wrote:
> > rjmccall wrote:
> > > svenvh wrote:
> > > > rjmccall wrote:
> > > > > You might consider parsing the statement normally and then just diagnosing after the fact, maybe in Sema.  You'd have to add the check in a couple different places, though.
> > > > Precisely the reason why I did it in the parser, otherwise we'd have to duplicate the check in multiple places.
> > > The downside of this is that the parser recovery is probably very bad.  But since this is asm, it's not likely to matter too much.
> > > 
> > > ...is this *also* really only an OpenCL C++ restriction?  Maybe we should read this one as a general restriction that happens to have been overlooked in the OpenCL C spec.
> > Yes, `asm` is only explicitly restricted in OpenCL C++.  Not sure if it's safe to assume `asm` has been overlooked for OpenCL C though, it's not explicitly forbidden so people may be using it.
> Do you have any contact with the OpenCL committee?  You might want to collect these issues and present them to them.  They may just not be aware that `asm` is just as much a feature in C as it is in C++, and it would be good to understand what the purpose of the `goto` restriction is.
Yes, we can clarify this with Khronos.  Shall I leave the `asm` and `goto` restrictions out of this patch for now until we have clarification?


https://reviews.llvm.org/D46022





More information about the cfe-commits mailing list