================
@@ -202,6 +202,25 @@ void SemaSYCL::handleKernelAttr(Decl *D, const ParsedAttr 
&AL) {
   handleSimpleAttribute<DeviceKernelAttr>(*this, D, AL);
 }
 
+void SemaSYCL::handleExternalAttr(Decl *D, const ParsedAttr &AL) {
+  auto *FD = cast<FunctionDecl>(D);
+  if (!FD->isExternallyVisible()) {
+    Diag(AL.getLoc(), diag::err_sycl_attribute_invalid_linkage);
+    return;
+  }
----------------
tahonermann wrote:

I think the check for external linkage is better done in 
`Sema::CheckFunctionDeclaration()` so that other semantic checking of the 
function is done first. See the call to `CheckSYCLEntryPointFunctionDecl()` 
there; perhaps it makes sense to replicate that redirection to a 
`CheckSYCLExternalFunctionDecl()` function defined here.

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