Skip to content

Commit 8d0087e

Browse files
committed
Revert "[SYCL] Support or diagnose use of namespace std types as kernel type names"
This reverts commit 46c54c6. # Conflicts: # clang/test/CodeGenSYCL/stdtypes_kernel_type.cpp # clang/test/SemaSYCL/unnamed-kernel.cpp
1 parent a96b556 commit 8d0087e

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

clang/lib/Sema/SemaSYCL.cpp

+23-20
Original file line numberDiff line numberDiff line change
@@ -2727,27 +2727,30 @@ void SYCLIntegrationHeader::emitFwdDecl(raw_ostream &O, const Decl *D,
27272727
auto *NS = dyn_cast_or_null<NamespaceDecl>(DC);
27282728

27292729
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) {
27452740
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+
}
27512754
}
27522755
}
27532756
break;

0 commit comments

Comments
 (0)