================
@@ -250,6 +250,20 @@ static bool CheckSYCLKernelName(Sema &S, SourceLocation 
Loc,
   return false;
 }
 
+void SemaSYCL::CheckSYCLExternalFunctionDecl(FunctionDecl *FD) {
+  const auto *SEAttr = FD->getAttr<SYCLExternalAttr>();
+  assert(SEAttr && "Missing sycl_external attribute");
+  if (!FD->isExternallyVisible()) {
+    Diag(SEAttr->getLocation(), diag::err_sycl_external_invalid_linkage)
+        << SEAttr;
+  }
----------------
tahonermann wrote:

This change will suffice to address the diagnostic issues with explicit and 
implicit template instantiations. There will still be some issues with explicit 
specializations due to attributes inherited from the implicit instantiation of 
the corresponding declaration from the primary template, but that's ok for now.
```suggestion
  if (!FD->isInvalidDecl() && !FD->isTemplated()) {
    if (!FD->isExternallyVisible())
      if (!FD->isFunctionTemplateSpecialization() ||
          FD->getTemplateSpecializationInfo()->isExplicitSpecialization())
        Diag(SEAttr->getLocation(), diag::err_sycl_external_invalid_linkage)
            << SEAttr;
```

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

Reply via email to