Skip to content

Commit c906a67

Browse files
authored
[SYCL][FPGA] Update [[intel::use_stall_enable_clusters]] attribute (#5053)
This patch refactors [[intel::use_stall_enable_clusters]] attribute: 1. Uses automatic diagnostic checking when passing the wrong number of arguments (which is an error instead of a warning and this behavior is more consistent with other attributes). 2. The attribute has no arguments, So this only returns the attribute itself instead of handleSimpleAttribute<SYCLIntelUseStallEnableClustersAttr> 3. Existing test (SemaSYCL/stall_enable_device.cpp) shows the behavior of automatic diagnostic checking when passing the wrong number of arguments Example: [[intel::use_stall_enable_clusters(1)]] void test1() {} // expected-error{{'use_stall_enable_clusters' attribute takes no arguments}} Signed-off-by: Soumi Manna <[email protected]>
1 parent 9b3465e commit c906a67

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3560,18 +3560,10 @@ static void handleSYCLIntelNumSimdWorkItemsAttr(Sema &S, Decl *D,
35603560
}
35613561

35623562
// Handles use_stall_enable_clusters
3563-
static void handleUseStallEnableClustersAttr(Sema &S, Decl *D,
3564-
const ParsedAttr &Attr) {
3565-
if (D->isInvalidDecl())
3566-
return;
3567-
3568-
unsigned NumArgs = Attr.getNumArgs();
3569-
if (NumArgs > 0) {
3570-
S.Diag(Attr.getLoc(), diag::warn_attribute_too_many_arguments) << Attr << 0;
3571-
return;
3572-
}
3573-
3574-
handleSimpleAttribute<SYCLIntelUseStallEnableClustersAttr>(S, D, Attr);
3563+
static void handleSYCLIntelUseStallEnableClustersAttr(Sema &S, Decl *D,
3564+
const ParsedAttr &A) {
3565+
D->addAttr(::new (S.Context)
3566+
SYCLIntelUseStallEnableClustersAttr(S.Context, A));
35753567
}
35763568

35773569
// Handles disable_loop_pipelining attribute.
@@ -9979,7 +9971,7 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
99799971
handleSYCLIntelNoGlobalWorkOffsetAttr(S, D, AL);
99809972
break;
99819973
case ParsedAttr::AT_SYCLIntelUseStallEnableClusters:
9982-
handleUseStallEnableClustersAttr(S, D, AL);
9974+
handleSYCLIntelUseStallEnableClustersAttr(S, D, AL);
99839975
break;
99849976
case ParsedAttr::AT_SYCLIntelLoopFuse:
99859977
handleSYCLIntelLoopFuseAttr(S, D, AL);

0 commit comments

Comments
 (0)