================
@@ -4902,6 +4902,23 @@ void Sema::checkCall(NamedDecl *FDecl, const
FunctionProtoType *Proto,
SYCL().DiagIfDeviceCode(Loc, diag::err_variadic_device_fn)
<< diag::OffloadLang::SYCL;
+ // Functions requiring host target features or a host CPU are host-only.
+ if (FD && getLangOpts().SYCLIsDevice && !isUnevaluatedContext() &&
+ !isConstantEvaluatedContext())
+ if (const auto *TA = FD->getAttr<TargetAttr>())
+ if (const TargetInfo *Aux = Context.getAuxTargetInfo()) {
+ ParsedTargetAttr P = Aux->parseTargetAttr(TA->getFeaturesStr());
+ auto It = llvm::find_if(P.Features, [&](StringRef F) {
+ return F.consume_front("+") && Aux->isValidFeatureName(F);
----------------
schittir wrote:
Right, that's the idea, but I see that it isn't diagnosed when the attribute is
parsed, since SPIR accepts any feature or CPU name... I dropped the check here.
Diagnosing invalid names at parse time can be a follow-up.
https://github.com/llvm/llvm-project/pull/227665
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits