================
@@ -206,3 +208,124 @@ void SemaSYCL::handleKernelEntryPointAttr(Decl *D, const 
ParsedAttr &AL) {
   D->addAttr(::new (SemaRef.Context)
                  SYCLKernelEntryPointAttr(SemaRef.Context, AL, TSI));
 }
+
+static SourceLocation SourceLocationForType(QualType QT) {
+  SourceLocation Loc;
+  const Type *T = QT->getUnqualifiedDesugaredType();
+  if (const TagType *TT = dyn_cast<TagType>(T))
+    Loc = TT->getDecl()->getLocation();
+  else if (const ObjCInterfaceType *ObjCIT = dyn_cast<ObjCInterfaceType>(T))
+    Loc = ObjCIT->getDecl()->getLocation();
+  return Loc;
+}
+
+static bool CheckSYCLKernelName(Sema &S, SourceLocation Loc,
+                                QualType KernelName) {
+  assert(!KernelName->isDependentType());
+
+  if (!KernelName->isStructureOrClassType()) {
----------------
tahonermann wrote:

`isStructureOrClassType()` excludes unions (but includes Microsoft's 
`__interface` types; we could exclude those); see 
[here](https://github.com/llvm/llvm-project/blob/2b932bc111c0d96db7044b0a854d7ad763710df2/clang/lib/AST/Type.cpp#L690-L696).
 

The SYCL 2020 specification is imprecise; see 
[here](https://github.com/KhronosGroup/SYCL-Docs/issues/568) for an issue I 
previously reported against it. For now, I've been taking a conservative view 
and restricting what is allowed to just non-union class types. We can then lift 
these restrictions once the SYCL specification is clarified.

https://github.com/llvm/llvm-project/pull/120327
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to