================
@@ -208,6 +208,15 @@ void SemaSYCL::handleExternalAttr(Decl *D, const 
ParsedAttr &AL) {
     Diag(AL.getLoc(), diag::err_sycl_attribute_invalid_linkage);
     return;
   }
+  std::string FunctionName = 
StringRef(FD->getNameInfo().getAsString()).lower();
+  if (FunctionName.find("main") != std::string::npos) {
+    Diag(AL.getLoc(), diag::err_sycl_attribute_avoid_main);
+    return;
+  }
----------------
tahonermann wrote:

I think the check for application to `main()` is better done in 
`Sema::CheckMain()`. See the other diagnostics there that call `Diag` with a 
`diag::err*` argument. It looks like `FD->setInvalidDecl()` should also be 
called in that case.

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