Skip to content

Commit 1c4e611

Browse files
committed
Added clang AST test for attribute propagation.
1 parent 7bc5466 commit 1c4e611

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// RUN: %clang_cc1 %s -fsyntax-only -ast-dump -fsycl -fsycl-is-device -triple spir64 | FileCheck %s
2+
3+
template <typename Name, typename Type>
4+
[[clang::sycl_kernel]] void __my_kernel__(Type bar) {
5+
bar();
6+
}
7+
8+
template <typename Name, typename Type> void parallel_for(Type lambda) {
9+
__my_kernel__<Name>(lambda);
10+
}
11+
12+
template <typename T> class Fobj {
13+
public:
14+
Fobj() {}
15+
void operator()() const {
16+
auto L0 = []() [[intel::reqd_sub_group_size(4)]]{};
17+
L0();
18+
}
19+
};
20+
21+
void invoke() {
22+
Fobj<int> fobj1;
23+
parallel_for<class __pf_kernel_wrapper>(fobj1);
24+
Fobj<short> fobj2;
25+
parallel_for<class PPP>(fobj2);
26+
}
27+
28+
// CHECK-LABEL: ClassTemplateSpecializationDecl {{.*}} class Fobj definition
29+
// CHECK: TemplateArgument type 'int'
30+
// CHECK: CXXMethodDecl {{.*}} used operator() 'void () const'
31+
// CHECK: CXXMethodDecl {{.*}} used operator() 'void () const' inline
32+
// CHECK-NEXT: CompoundStmt
33+
// CHECK-NEXT: IntelReqdSubGroupSizeAttr {{.*}}
34+
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 4
35+
// CHECK: CXXOperatorCallExpr {{.*}} 'void':'void' '()'
36+
// CHECK: IntelReqdSubGroupSizeAttr {{.*}}
37+
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 4
38+
// CHECK: CXXDestructorDecl
39+
40+
// CHECK-LABEL: ClassTemplateSpecializationDecl {{.*}} class Fobj definition
41+
// CHECK: TemplateArgument type 'short'
42+
// CHECK: CXXMethodDecl {{.*}} used operator() 'void () const'
43+
// CHECK: CXXMethodDecl {{.*}} used operator() 'void () const' inline
44+
// CHECK-NEXT: CompoundStmt
45+
// CHECK-NEXT: IntelReqdSubGroupSizeAttr {{.*}}
46+
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 4
47+
// CHECK: CXXOperatorCallExpr {{.*}} 'void':'void' '()'
48+
// CHECK-NOT: IntelReqdSubGroupSizeAttr {{.*}}
49+
// CHECK-NOT: IntegerLiteral {{.*}} 'int' 4
50+
// CHECK: CXXDestructorDecl

0 commit comments

Comments
 (0)