Skip to content

Commit a806343

Browse files
author
Sergey Kanaev
committed
[SYCL] Fix some code-style issues
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent bba50f2 commit a806343

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// RUN: %clang_cc1 -fcxx-exceptions -fsycl-is-device -Wno-return-type -verify -fsyntax-only -std=c++17 %s
22
void bar();
33

4-
template<typename T>
5-
void usage(T func ) {
4+
template <typename T>
5+
void usage(T func) {
66
bar();
77
}
88

@@ -12,16 +12,16 @@ __attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
1212
}
1313

1414
SYCL_EXTERNAL void foo();
15-
// expected-error@+2 {{SYCL kernel cannot call a recursive function}}
16-
// expected-note@+1 2{{function implemented using recursion declared here}}
15+
// expected-error@+2 {{SYCL kernel cannot call a recursive function}}
16+
// expected-note@+1 2{{function implemented using recursion declared here}}
1717
void fum() { return fum(); };
1818
int main() {
19-
kernel_single_task<class fake_kernel>([]() { usage(foo ); });
19+
kernel_single_task<class fake_kernel>([]() { usage(foo); });
2020
}
21-
template<typename T>
21+
template <typename T>
2222
void templ_func() {
2323
// expected-error@+1 {{SYCL kernel cannot call a recursive function}}
2424
fum();
2525
foo();
2626
}
27-
void bar(){ templ_func<int>(); }
27+
void bar() { templ_func<int>(); }

clang/test/SemaSYCL/restrict-recursion3.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@
22

33
// This recursive function is not called from sycl kernel,
44
// so it should not be diagnosed.
5-
int fib(int n)
6-
{
7-
if (n <= 1)
8-
return n;
9-
return fib(n-1) + fib(n-2);
5+
int fib(int n) {
6+
if (n <= 1)
7+
return n;
8+
return fib(n - 1) + fib(n - 2);
109
}
1110

1211
void kernel3(void) {
1312
;
1413
}
1514

16-
using myFuncDef = int(int,int);
15+
using myFuncDef = int(int, int);
1716

1817
typedef __typeof__(sizeof(int)) size_t;
1918

2019
SYCL_EXTERNAL
21-
void* operator new(size_t);
20+
void *operator new(size_t);
2221

2322
void usage3(myFuncDef functionPtr) {
2423
// expected-error@+1 {{SYCL kernel cannot allocate storage}}
@@ -27,11 +26,11 @@ void usage3(myFuncDef functionPtr) {
2726
}
2827

2928
int addInt(int n, int m) {
30-
return n+m;
29+
return n + m;
3130
}
3231

3332
template <typename name, typename Func>
34-
// expected-note@+1 2{{function implemented using recursion declared here}}
33+
// expected-note@+1 2{{function implemented using recursion declared here}}
3534
__attribute__((sycl_kernel)) void kernel_single_task2(Func kernelFunc) {
3635
// expected-note@+1 {{called by 'kernel_single_task2}}
3736
kernelFunc();
@@ -41,6 +40,6 @@ __attribute__((sycl_kernel)) void kernel_single_task2(Func kernelFunc) {
4140

4241
int main() {
4342
// expected-note@+1 {{called by 'operator()'}}
44-
kernel_single_task2<class fake_kernel>([]() { usage3( &addInt ); });
43+
kernel_single_task2<class fake_kernel>([]() { usage3(&addInt); });
4544
return fib(5);
4645
}

0 commit comments

Comments
 (0)