Skip to content

Commit

Permalink
Revert "[SYCL] Support or diagnose use of namespace std types as kern…
Browse files Browse the repository at this point in the history
…el type names"

This reverts commit 46c54c6.

# Conflicts:
#	clang/test/CodeGenSYCL/stdtypes_kernel_type.cpp
#	clang/test/SemaSYCL/unnamed-kernel.cpp
  • Loading branch information
jtmott-intel committed Sep 11, 2020
1 parent a96b556 commit 8d0087e
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2727,27 +2727,30 @@ void SYCLIntegrationHeader::emitFwdDecl(raw_ostream &O, const Decl *D,
auto *NS = dyn_cast_or_null<NamespaceDecl>(DC);

if (!NS) {
const TagDecl *TD = isa<ClassTemplateDecl>(D)
? cast<ClassTemplateDecl>(D)->getTemplatedDecl()
: dyn_cast<TagDecl>(D);
if (!TD)
break;

const bool KernelNameIsMissing = TD->getName().empty();
if (KernelNameIsMissing)
Diag.Report(KernelLocation, diag::err_sycl_kernel_incorrectly_named)
<< /* kernel name is missing */ 0;
else if (!DC->isTranslationUnit()) {
// defined class constituting the kernel name is not globally
// accessible - contradicts the spec
if (!UnnamedLambdaSupport) {
if (TD->isCompleteDefinition())
if (!DC->isTranslationUnit()) {
const TagDecl *TD = isa<ClassTemplateDecl>(D)
? cast<ClassTemplateDecl>(D)->getTemplatedDecl()
: dyn_cast<TagDecl>(D);

if (TD && !UnnamedLambdaSupport) {
// defined class constituting the kernel name is not globally
// accessible - contradicts the spec
const bool KernelNameIsMissing = TD->getName().empty();
if (KernelNameIsMissing) {
Diag.Report(KernelLocation, diag::err_sycl_kernel_incorrectly_named)
<< /* kernel name is not globally-visible */ 1;
else
Diag.Report(KernelLocation, diag::warn_sycl_implicit_decl);
Diag.Report(D->getSourceRange().getBegin(), diag::note_previous_decl)
<< TD->getName();
<< /* kernel name is missing */ 0;
// Don't emit note if kernel name was completely omitted
} else {
if (TD->isCompleteDefinition())
Diag.Report(KernelLocation,
diag::err_sycl_kernel_incorrectly_named)
<< /* kernel name is not globally-visible */ 1;
else
Diag.Report(KernelLocation, diag::warn_sycl_implicit_decl);
Diag.Report(D->getSourceRange().getBegin(),
diag::note_previous_decl)
<< TD->getName();
}
}
}
break;
Expand Down

0 comments on commit 8d0087e

Please sign in to comment.