================ @@ -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()) { ---------------- erichkeane wrote:
Ah, so enforcing class or structure, and `class` in `[class]` refers to union as well. So either the SYCL standard is imprecise (and we should probably be more precise with the diagnostic), or this line should really be: ```suggestion if (!KernelName->isStructureOrClassType() && !KernelName->isUnionType()) { ``` 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