Skip to content

Commit 722006c

Browse files
Andrew Savonichevvladimirlaz
Andrew Savonichev
authored andcommitted
Change subject from FunctionLike to Function; add tests for subject
FunctionLike also applies to function pointers, which is probably not what we want. Signed-off-by: Andrew Savonichev <[email protected]>
1 parent f786219 commit 722006c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ def SYCLDeviceIndirectlyCallable : InheritableAttr {
10931093
}
10941094
def SYCLIntelKernelArgsRestrict : InheritableAttr {
10951095
let Spellings = [ CXX11<"intel", "kernel_args_restrict"> ];
1096-
let Subjects = SubjectList<[ FunctionLike ], ErrorDiag>;
1096+
let Subjects = SubjectList<[Function], ErrorDiag>;
10971097
let LangOpts = [ SYCLIsDevice, SYCLIsHost ];
10981098
let Documentation = [ SYCLIntelKernelArgsRestrictDocs ];
10991099
}

clang/test/Misc/pragma-attribute-supported-attributes-list.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
// CHECK-NEXT: ReturnsTwice (SubjectMatchRule_function)
132132
// CHECK-NEXT: SYCLDevice (SubjectMatchRule_function)
133133
// CHECK-NEXT: SYCLDeviceIndirectlyCallable (SubjectMatchRule_function)
134-
// CHECK-NEXT: SYCLIntelKernelArgsRestrict (SubjectMatchRule_hasType_functionType)
134+
// CHECK-NEXT: SYCLIntelKernelArgsRestrict (SubjectMatchRule_function)
135135
// CHECK-NEXT: SYCLKernel (SubjectMatchRule_function)
136136
// CHECK-NEXT: ScopedLockable (SubjectMatchRule_record)
137137
// CHECK-NEXT: Section (SubjectMatchRule_function, SubjectMatchRule_variable_is_global, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property)

clang/test/SemaSYCL/intel-restrict.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[[intel::kernel_args_restrict]] // expected-warning{{'kernel_args_restrict' attribute ignored}}
55
void func_ignore() {}
66

7-
87
struct FuncObj {
98
[[intel::kernel_args_restrict]]
109
void operator()() {}
@@ -13,6 +12,9 @@ struct FuncObj {
1312
template <typename name, typename Func>
1413
__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
1514
kernelFunc();
15+
#ifdef CHECKDIAG
16+
[[intel::kernel_args_restrict]] int invalid = 42; // expected-error{{'kernel_args_restrict' attribute only applies to functions}}
17+
#endif
1618
}
1719

1820
int main() {

0 commit comments

Comments
 (0)