@@ -2727,27 +2727,30 @@ void SYCLIntegrationHeader::emitFwdDecl(raw_ostream &O, const Decl *D,
2727
2727
auto *NS = dyn_cast_or_null<NamespaceDecl>(DC);
2728
2728
2729
2729
if (!NS) {
2730
- const TagDecl *TD = isa<ClassTemplateDecl>(D)
2731
- ? cast<ClassTemplateDecl>(D)->getTemplatedDecl ()
2732
- : dyn_cast<TagDecl>(D);
2733
- if (!TD)
2734
- break ;
2735
-
2736
- const bool KernelNameIsMissing = TD->getName ().empty ();
2737
- if (KernelNameIsMissing)
2738
- Diag.Report (KernelLocation, diag::err_sycl_kernel_incorrectly_named)
2739
- << /* kernel name is missing */ 0 ;
2740
- else if (!DC->isTranslationUnit ()) {
2741
- // defined class constituting the kernel name is not globally
2742
- // accessible - contradicts the spec
2743
- if (!UnnamedLambdaSupport) {
2744
- if (TD->isCompleteDefinition ())
2730
+ if (!DC->isTranslationUnit ()) {
2731
+ const TagDecl *TD = isa<ClassTemplateDecl>(D)
2732
+ ? cast<ClassTemplateDecl>(D)->getTemplatedDecl ()
2733
+ : dyn_cast<TagDecl>(D);
2734
+
2735
+ if (TD && !UnnamedLambdaSupport) {
2736
+ // defined class constituting the kernel name is not globally
2737
+ // accessible - contradicts the spec
2738
+ const bool KernelNameIsMissing = TD->getName ().empty ();
2739
+ if (KernelNameIsMissing) {
2745
2740
Diag.Report (KernelLocation, diag::err_sycl_kernel_incorrectly_named)
2746
- << /* kernel name is not globally-visible */ 1 ;
2747
- else
2748
- Diag.Report (KernelLocation, diag::warn_sycl_implicit_decl);
2749
- Diag.Report (D->getSourceRange ().getBegin (), diag::note_previous_decl)
2750
- << TD->getName ();
2741
+ << /* kernel name is missing */ 0 ;
2742
+ // Don't emit note if kernel name was completely omitted
2743
+ } else {
2744
+ if (TD->isCompleteDefinition ())
2745
+ Diag.Report (KernelLocation,
2746
+ diag::err_sycl_kernel_incorrectly_named)
2747
+ << /* kernel name is not globally-visible */ 1 ;
2748
+ else
2749
+ Diag.Report (KernelLocation, diag::warn_sycl_implicit_decl);
2750
+ Diag.Report (D->getSourceRange ().getBegin (),
2751
+ diag::note_previous_decl)
2752
+ << TD->getName ();
2753
+ }
2751
2754
}
2752
2755
}
2753
2756
break ;
0 commit comments