@@ -262,12 +262,13 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
262
262
if (!getASTContext ().hasSameType (SAI->getKernelName (),
263
263
SKEPAttr->getKernelName ())) {
264
264
Diag (SAI->getLocation (), diag::err_sycl_entry_point_invalid_redeclaration)
265
- << SAI->getKernelName () << SKEPAttr->getKernelName ();
265
+ << SKEPAttr << SAI->getKernelName () << SKEPAttr->getKernelName ();
266
266
Diag (SKEPAttr->getLocation (), diag::note_previous_attribute);
267
267
SAI->setInvalidAttr ();
268
268
} else {
269
269
Diag (SAI->getLocation (),
270
- diag::warn_sycl_entry_point_redundant_declaration);
270
+ diag::warn_sycl_entry_point_redundant_declaration)
271
+ << SAI;
271
272
Diag (SKEPAttr->getLocation (), diag::note_previous_attribute);
272
273
}
273
274
}
@@ -289,7 +290,8 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
289
290
PrevSKEPAttr->getKernelName ())) {
290
291
Diag (SKEPAttr->getLocation (),
291
292
diag::err_sycl_entry_point_invalid_redeclaration)
292
- << SKEPAttr->getKernelName () << PrevSKEPAttr->getKernelName ();
293
+ << SKEPAttr << SKEPAttr->getKernelName ()
294
+ << PrevSKEPAttr->getKernelName ();
293
295
Diag (PrevSKEPAttr->getLocation (), diag::note_previous_decl) << PrevFD;
294
296
SKEPAttr->setInvalidAttr ();
295
297
}
@@ -299,50 +301,52 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
299
301
if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
300
302
if (!MD->isStatic ()) {
301
303
Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
302
- << /* non-static member function*/ 0 ;
304
+ << SKEPAttr << /* non-static member function*/ 0 ;
303
305
SKEPAttr->setInvalidAttr ();
304
306
}
305
307
}
306
308
307
309
if (FD->isVariadic ()) {
308
310
Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
309
- << /* variadic function*/ 1 ;
311
+ << SKEPAttr << /* variadic function*/ 1 ;
310
312
SKEPAttr->setInvalidAttr ();
311
313
}
312
314
313
315
if (FD->isDefaulted ()) {
314
316
Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
315
- << /* defaulted function*/ 3 ;
317
+ << SKEPAttr << /* defaulted function*/ 3 ;
316
318
SKEPAttr->setInvalidAttr ();
317
319
} else if (FD->isDeleted ()) {
318
320
Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
319
- << /* deleted function*/ 2 ;
321
+ << SKEPAttr << /* deleted function*/ 2 ;
320
322
SKEPAttr->setInvalidAttr ();
321
323
}
322
324
323
325
if (FD->isConsteval ()) {
324
326
Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
325
- << /* consteval function*/ 5 ;
327
+ << SKEPAttr << /* consteval function*/ 5 ;
326
328
SKEPAttr->setInvalidAttr ();
327
329
} else if (FD->isConstexpr ()) {
328
330
Diag (SKEPAttr->getLocation (), diag::err_sycl_entry_point_invalid)
329
- << /* constexpr function*/ 4 ;
331
+ << SKEPAttr << /* constexpr function*/ 4 ;
330
332
SKEPAttr->setInvalidAttr ();
331
333
}
332
334
333
335
if (FD->isNoReturn ()) {
334
336
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 ;
336
338
SKEPAttr->setInvalidAttr ();
337
339
}
338
340
339
341
if (FD->getReturnType ()->isUndeducedType ()) {
340
342
Diag (SKEPAttr->getLocation (),
341
- diag::err_sycl_entry_point_deduced_return_type);
343
+ diag::err_sycl_entry_point_deduced_return_type)
344
+ << SKEPAttr;
342
345
SKEPAttr->setInvalidAttr ();
343
346
} else if (!FD->getReturnType ()->isDependentType () &&
344
347
!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;
346
350
SKEPAttr->setInvalidAttr ();
347
351
}
348
352
@@ -354,7 +358,8 @@ void SemaSYCL::CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD) {
354
358
if (!declaresSameEntity (FD, SKI->getKernelEntryPointDecl ())) {
355
359
// FIXME: This diagnostic should include the origin of the kernel
356
360
// 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;
358
363
Diag (SKI->getKernelEntryPointDecl ()->getLocation (),
359
364
diag::note_previous_declaration);
360
365
SKEPAttr->setInvalidAttr ();
0 commit comments