Skip to content

Commit 1d658c4

Browse files
author
Erich Keane
committed
Add test
1 parent b986c30 commit 1d658c4

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// RUN: %clang_cc1 -fsycl-is-device -fsycl-int-header=%t.h %s -o %t.out
2+
// RUN: FileCheck -input-file=%t.h %s
3+
4+
// This test validates the behavior of inline-kernel-names to try to put them in
5+
// the 'closest' possible namespace.
6+
7+
#include "Inputs/sycl.hpp"
8+
9+
using namespace sycl;
10+
11+
// Forward declarations of templated kernel function types:
12+
13+
namespace TopLevel {
14+
void use() {
15+
kernel_single_task<class DirectTopLevel>([]() {});
16+
// CHECK: namespace TopLevel {
17+
// CHECK-NEXT: class DirectTopLevel;
18+
// CHECK-NEXT: }
19+
}
20+
21+
struct TypeName {
22+
void member_func() {
23+
kernel_single_task<class DirectTopLevelMemFunc>([]() {});
24+
// CHECK: namespace TopLevel {
25+
// CHECK-NEXT: class DirectTopLevelMemFunc;
26+
// CHECK-NEXT: }
27+
}
28+
};
29+
30+
extern "C" {
31+
void use1() {
32+
kernel_single_task<class DirectTopLevelLinkage>([]() {});
33+
// CHECK: namespace TopLevel {
34+
// CHECK-NEXT: class DirectTopLevelLinkage;
35+
// CHECK-NEXT: }
36+
}
37+
struct LinkageTypeName {
38+
void member_func() {
39+
kernel_single_task<class DirectTopLevelLinkageMemFunc>([]() {});
40+
// CHECK: namespace TopLevel {
41+
// CHECK-NEXT: class DirectTopLevelLinkageMemFunc;
42+
// CHECK-NEXT: }
43+
}
44+
};
45+
}
46+
} // namespace TopLevel
47+
48+
namespace {
49+
void use2() {
50+
kernel_single_task<class TopLevelAnonNS>([]() {});
51+
// CHECK: namespace {
52+
// CHECK-NEXT: class TopLevelAnonNS;
53+
// CHECK-NEXT: }
54+
}
55+
56+
struct LinkageTypeName {
57+
void member_func() {
58+
kernel_single_task<class AnonNSMemFunc>([]() {});
59+
// CHECK: namespace {
60+
// CHECK-NEXT: class AnonNSMemFunc;
61+
// CHECK-NEXT: }
62+
}
63+
};
64+
} // namespace
65+
66+
inline namespace InlineTopLevel {
67+
void use3() {
68+
kernel_single_task<class InlineDirectTopLevel>([]() {});
69+
// CHECK: inline namespace InlineTopLevel {
70+
// CHECK-NEXT: class InlineDirectTopLevel;
71+
// CHECK-NEXT: }
72+
}
73+
struct LinkageTypeName {
74+
void member_func() {
75+
kernel_single_task<class InlineNSMemFunc>([]() {});
76+
// CHECK: inline namespace InlineTopLevel {
77+
// CHECK-NEXT: class InlineNSMemFunc;
78+
// CHECK-NEXT: }
79+
}
80+
};
81+
82+
inline namespace {
83+
void use4() {
84+
kernel_single_task<class AnonNS>([]() {});
85+
// CHECK: inline namespace {
86+
// CHECK-NEXT: class AnonNS;
87+
// CHECK-NEXT: }
88+
}
89+
90+
extern "C" {
91+
void use5() {
92+
kernel_single_task<class AnonNSLinkage>([]() {});
93+
// CHECK: inline namespace {
94+
// CHECK-NEXT: class AnonNSLinkage;
95+
// CHECK-NEXT: }
96+
}
97+
}
98+
struct LinkageTypeName {
99+
void member_func() {
100+
kernel_single_task<class InlineAnonNSMemFunc>([]() {});
101+
// CHECK: inline namespace {
102+
// CHECK-NEXT: class InlineAnonNSMemFunc;
103+
// CHECK-NEXT: }
104+
}
105+
};
106+
} // namespace
107+
} // namespace TopLevel
108+
109+
namespace A {
110+
namespace B {
111+
namespace {
112+
namespace C::D {
113+
struct DeepStruct {
114+
void member_func() {
115+
kernel_single_task<class WoahDeep>([]() {});
116+
// CHECK: namespace A { namespace B { namespace { namespace C { namespace D {
117+
// CHECK-NEXT: class WoahDeep;
118+
// CHECK-NEXT: }}}}}
119+
}
120+
};
121+
} // namespace C::D
122+
} // namespace
123+
} // namespace B
124+
} // namespace A

0 commit comments

Comments
 (0)