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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 30 13:59:24 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/Parse/ParseStmtAsm.cpp:696
+    return StmtError();
+  }
+
----------------
svenvh wrote:
> 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?
That might be best.  It'd be easy enough to apply them later.


================
Comment at: lib/Sema/SemaDecl.cpp:6380
+      }
+    }
   }
----------------
This is another thing to check out with Khronos, because `_Thread_local` and `__thread` are also available in C.

In this case, I think it's almost certain that they intend the restriction to be general, so I'd just proactively apply it in an OpenCL modes.


https://reviews.llvm.org/D46022





More information about the cfe-commits mailing list