Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -13413,8 +13413,9 @@ def err_sycl_add_ir_attribute_invalid_filter : Error<
"initializer list in the first argument of %0 must contain only string "
"literals">;
def warn_sycl_old_and_new_kernel_attributes : Warning<
"kernel has both attribute %0 and kernel properties; conflicting properties "
"are ignored">, InGroup<IgnoredAttributes>;
"kernel has both attribute %0 and kernel properties; if the kernel "
"properties contains the property \"%1\" it will be ignored">,
InGroup<IgnoredAttributes>;
def err_attribute_argument_is_not_valid : Error<
"%0 attribute requires integer constant value 0 or 1">;

Expand Down
17 changes: 11 additions & 6 deletions clang/lib/Sema/SemaSYCLDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3153,14 +3153,19 @@ void SemaSYCL::checkSYCLAddIRAttributesFunctionAttrConflicts(Decl *D) {
}

// If there are potentially conflicting attributes, we issue a warning.
for (const auto *Attr : std::vector<AttributeCommonInfo *>{
D->getAttr<SYCLReqdWorkGroupSizeAttr>(),
D->getAttr<IntelReqdSubGroupSizeAttr>(),
D->getAttr<SYCLWorkGroupSizeHintAttr>(),
D->getAttr<SYCLDeviceHasAttr>()})
for (const auto [Attr, PotentialConflictProp] :
std::vector<std::pair<AttributeCommonInfo *, StringRef>>{
{D->getAttr<SYCLReqdWorkGroupSizeAttr>(),
"sycl::ext::oneapi::experimental::work_group_size"},
{D->getAttr<IntelReqdSubGroupSizeAttr>(),
"sycl::ext::oneapi::experimental::sub_group_size"},
{D->getAttr<SYCLWorkGroupSizeHintAttr>(),
"sycl::ext::oneapi::experimental::work_group_size_hint"},
{D->getAttr<SYCLDeviceHasAttr>(),
"sycl::ext::oneapi::experimental::device_has"}})
if (Attr)
Diag(Attr->getLoc(), diag::warn_sycl_old_and_new_kernel_attributes)
<< Attr;
<< Attr << PotentialConflictProp;
}

void SemaSYCL::handleSYCLRegisteredKernels(Decl *D, const ParsedAttr &A) {
Expand Down
Loading
Loading