Skip to content

Commit

Permalink
Reword functor -> function object
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Savonichev <[email protected]>
  • Loading branch information
Andrew Savonichev authored and vladimirlaz committed Oct 22, 2019
1 parent 9877623 commit f786219
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -1841,12 +1841,12 @@ def SYCLIntelKernelArgsRestrictDocs : Documentation {
let Content = [{
The attribute ``intel::kernel_args_restrict`` is legal on device functions, and
can be ignored on non-device functions. When applied to a function, lambda, or
function call operator (of a functor), the attribute is a hint to the compiler
equivalent to specifying the C99 restrict attribute on all pointer arguments or
the pointer member of any accessors, which are a function argument, lambda
capture, or functor member, of the callable to which the attribute was
applied. This effect is equivalent to annotating restrict on **all** kernel
pointer arguments in an OpenCL or SPIR-V kernel.
function call operator (of a function object), the attribute is a hint to the
compiler equivalent to specifying the C99 restrict attribute on all pointer
arguments or the pointer member of any accessors, which are a function argument,
lambda capture, or function object member, of the callable to which the
attribute was applied. This effect is equivalent to annotating restrict on
**all** kernel pointer arguments in an OpenCL or SPIR-V kernel.

If ``intel::kernel_args_restrict`` is applied to a function called from a device
kernel, the attribute is ignored and it is not propagated to a kernel.
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class MarkDeviceFunction : public RecursiveASTVisitor<MarkDeviceFunction> {
else if (auto *A = FD->getAttr<ReqdWorkGroupSizeAttr>())
Attrs.insert(A);
else if (auto *A = FD->getAttr<SYCLIntelKernelArgsRestrictAttr>()) {
// Allow the intel::kernel_args_restrict only on the lambda (functor
// Allow the intel::kernel_args_restrict only on the lambda (function
// object) function, that is called directly from a kernel (i.e. the one
// passed to the parallel_for function). Emit a warning and ignore all
// other cases.
Expand Down
4 changes: 2 additions & 2 deletions clang/test/SemaSYCL/intel-restrict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
void func_ignore() {}


struct Functor {
struct FuncObj {
[[intel::kernel_args_restrict]]
void operator()() {}
};
Expand All @@ -19,7 +19,7 @@ int main() {
// CHECK-LABEL: FunctionDecl {{.*}} _ZTSZ4mainE12test_kernel1
// CHECK: SYCLIntelKernelArgsRestrictAttr
kernel<class test_kernel1>(
Functor());
FuncObj());

// CHECK-LABEL: FunctionDecl {{.*}} _ZTSZ4mainE12test_kernel2
// CHECK: SYCLIntelKernelArgsRestrictAttr
Expand Down

0 comments on commit f786219

Please sign in to comment.