Skip to content

Commit 81f3f8c

Browse files
Fznamznonvmaksimo
authored andcommitted
[SYCL] Integrate sycl_special_class attribute (8ba9c79) to intel/llvm
The upstream patch triggered assertion on most of SYCL tests: `AST/Decl.h:275: llvm::StringRef clang::NamedDecl::getName() const: Assertion Name.isIdentifier() && "Name is not a simple identifier"' failed.` Fix includes the following changes: * Check that name of function exists before trying to access it. * Make sure that host accessor doesn't have sycl_special_class attribute * Enable diagnostics for sycl_special_class attribute only for SYCL device compilation.
1 parent 11eeb80 commit 81f3f8c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9253,7 +9253,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
92539253
}
92549254
if ((Parent->isClass() || Parent->isStruct()) &&
92559255
Parent->hasAttr<SYCLSpecialClassAttr>() &&
9256-
NewFD->getKind() == Decl::Kind::CXXMethod &&
9256+
NewFD->getKind() == Decl::Kind::CXXMethod && NewFD->getIdentifier() &&
92579257
NewFD->getName() == "__init" && D.isFunctionDefinition()) {
92589258
if (auto *Def = Parent->getDefinition())
92599259
Def->setInitMethod(true);
@@ -16832,7 +16832,7 @@ void Sema::ActOnTagFinishDefinition(Scope *S, Decl *TagD,
1683216832

1683316833
if (auto *RD = dyn_cast<CXXRecordDecl>(Tag)) {
1683416834
FieldCollector->FinishClass();
16835-
if (RD->hasAttr<SYCLSpecialClassAttr>()) {
16835+
if (RD->hasAttr<SYCLSpecialClassAttr>() && getLangOpts().SYCLIsDevice) {
1683616836
auto *Def = RD->getDefinition();
1683716837
assert(Def && "The record is expected to have a completed definition");
1683816838
unsigned NumInitMethods = 0;

sycl/include/CL/sycl/accessor.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,8 +2200,8 @@ class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
22002200
/// \ingroup sycl_api_acc
22012201
template <typename DataT, int Dimensions, access::mode AccessMode,
22022202
access::placeholder IsPlaceholder>
2203-
class __SYCL_SPECIAL_CLASS accessor<DataT, Dimensions, AccessMode,
2204-
access::target::host_image, IsPlaceholder>
2203+
class accessor<DataT, Dimensions, AccessMode, access::target::host_image,
2204+
IsPlaceholder>
22052205
: public detail::image_accessor<DataT, Dimensions, AccessMode,
22062206
access::target::host_image, IsPlaceholder> {
22072207
public:

0 commit comments

Comments
 (0)