@@ -262,12 +262,13 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
262262 if (!getASTContext ().hasSameType (SAI->getKernelName (),
263263 SKEPAttr->getKernelName ())) {
264264 Diag (SAI->getLocation (), diag::err_sycl_entry_point_invalid_redeclaration)
265- << SAI->getKernelName () << SKEPAttr->getKernelName ();
265+ << SKEPAttr << SAI->getKernelName () << SKEPAttr->getKernelName ();
266266 Diag (SKEPAttr->getLocation (), diag::note_previous_attribute);
267267 SAI->setInvalidAttr ();
268268 } else {
269269 Diag (SAI->getLocation (),
270- diag::warn_sycl_entry_point_redundant_declaration);
270+ diag::warn_sycl_entry_point_redundant_declaration)
271+ << SAI;
271272 Diag (SKEPAttr->getLocation (), diag::note_previous_attribute);
272273 }
273274 }
@@ -289,7 +290,8 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
289290 PrevSKEPAttr->getKernelName ())) {
290291 Diag (SKEPAttr->getLocation (),
291292 diag::err_sycl_entry_point_invalid_redeclaration)
292- << SKEPAttr->getKernelName () << PrevSKEPAttr->getKernelName ();
293+ << SKEPAttr << SKEPAttr->getKernelName ()
294+ << PrevSKEPAttr->getKernelName ();
293295 Diag (PrevSKEPAttr->getLocation (), diag::note_previous_decl) << PrevFD;
294296 SKEPAttr->setInvalidAttr ();
295297 }
@@ -299,50 +301,52 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
299301 if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
300302 if (!MD->isStatic ()) {
301303 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
302- << /* non-static member function*/ 0 ;
304+ << SKEPAttr << /* non-static member function*/ 0 ;
303305 SKEPAttr->setInvalidAttr ();
304306 }
305307 }
306308
307309 if (FD->isVariadic ()) {
308310 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
309- << /* variadic function*/ 1 ;
311+ << SKEPAttr << /* variadic function*/ 1 ;
310312 SKEPAttr->setInvalidAttr ();
311313 }
312314
313315 if (FD->isDefaulted ()) {
314316 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
315- << /* defaulted function*/ 3 ;
317+ << SKEPAttr << /* defaulted function*/ 3 ;
316318 SKEPAttr->setInvalidAttr ();
317319 } else if (FD->isDeleted ()) {
318320 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
319- << /* deleted function*/ 2 ;
321+ << SKEPAttr << /* deleted function*/ 2 ;
320322 SKEPAttr->setInvalidAttr ();
321323 }
322324
323325 if (FD->isConsteval ()) {
324326 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
325- << /* consteval function*/ 5 ;
327+ << SKEPAttr << /* consteval function*/ 5 ;
326328 SKEPAttr->setInvalidAttr ();
327329 } else if (FD->isConstexpr ()) {
328330 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
329- << /* constexpr function*/ 4 ;
331+ << SKEPAttr << /* constexpr function*/ 4 ;
330332 SKEPAttr->setInvalidAttr ();
331333 }
332334
333335 if (FD->isNoReturn ()) {
334336 Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
335- << /* function declared with the 'noreturn' attribute*/ 6 ;
337+ << SKEPAttr << /* function declared with the 'noreturn' attribute*/ 6 ;
336338 SKEPAttr->setInvalidAttr ();
337339 }
338340
339341 if (FD->getReturnType ()->isUndeducedType ()) {
340342 Diag (SKEPAttr->getLocation (),
341- diag::err_sycl_entry_point_deduced_return_type);
343+ diag::err_sycl_entry_point_deduced_return_type)
344+ << SKEPAttr;
342345 SKEPAttr->setInvalidAttr ();
343346 } else if (!FD->getReturnType ()->isDependentType () &&
344347 !FD->getReturnType ()->isVoidType ()) {
345- Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_return_type);
348+ Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_return_type)
349+ << SKEPAttr;
346350 SKEPAttr->setInvalidAttr ();
347351 }
348352
@@ -354,7 +358,8 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
354358 if (!declaresSameEntity (FD, SKI->getKernelEntryPointDecl ())) {
355359 // FIXME: This diagnostic should include the origin of the kernel
356360 // FIXME: names; not just the locations of the conflicting declarations.
357- Diag (FD->getLocation (), diag::err_sycl_kernel_name_conflict);
361+ Diag (FD->getLocation (), diag::err_sycl_kernel_name_conflict)
362+ << SKEPAttr;
358363 Diag (SKI->getKernelEntryPointDecl ()->getLocation (),
359364 diag::note_previous_declaration);
360365 SKEPAttr->setInvalidAttr ();
0 commit comments