Skip to content

Commit 46b2b8a

Browse files
author
Erich Keane
authored
[SYCL] Fix integration-footer anon-NS handling to return right value (#3669)
Looks like I got carried away with the implementation and we didn't catch that I was returning the wrong things from the 'end call function' when generating anonymous function shims. This was brought up here: #3576 (review) This should fix that problem.
1 parent 2e65058 commit 46b2b8a

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4691,7 +4691,9 @@ bool SYCLIntegrationFooter::emit(raw_ostream &OS) {
46914691
OS << "template<>\n";
46924692
OS << "inline const char *get_spec_constant_symbolic_ID<" << TopShim
46934693
<< ">() {\n";
4694-
OS << " return " << TopShim << ";\n";
4694+
OS << " return \"";
4695+
emitSpecIDName(OS, VD);
4696+
OS << "\";\n";
46954697
} else {
46964698
OS << "namespace sycl {\n";
46974699
OS << "namespace detail {\n";

clang/test/CodeGenSYCL/anonymous_integration_footer.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct S2 {
6565
// CHECK-NEXT: namespace detail {
6666
// CHECK-NEXT: template<>
6767
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
68-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
68+
// CHECK-NEXT: return "";
6969
// CHECK-NEXT: }
7070
// CHECK-NEXT: // namespace detail
7171
// CHECK-NEXT: // namespace sycl
@@ -128,7 +128,7 @@ constexpr sycl::specialization_id same_name{7};
128128
// CHECK-NEXT: namespace detail {
129129
// CHECK-NEXT: template<>
130130
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
131-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
131+
// CHECK-NEXT: return "";
132132
// CHECK-NEXT: }
133133
// CHECK-NEXT: // namespace detail
134134
// CHECK-NEXT: // namespace sycl
@@ -147,7 +147,7 @@ constexpr sycl::specialization_id same_name{8};
147147
// CHECK-NEXT: namespace detail {
148148
// CHECK-NEXT: template<>
149149
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
150-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
150+
// CHECK-NEXT: return "";
151151
// CHECK-NEXT: }
152152
// CHECK-NEXT: // namespace detail
153153
// CHECK-NEXT: // namespace sycl
@@ -169,7 +169,7 @@ constexpr sycl::specialization_id same_name{9};
169169
// CHECK-NEXT: namespace detail {
170170
// CHECK-NEXT: template<>
171171
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::inner::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
172-
// CHECK-NEXT: return ::inner::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
172+
// CHECK-NEXT: return "";
173173
// CHECK-NEXT: }
174174
// CHECK-NEXT: // namespace detail
175175
// CHECK-NEXT: // namespace sycl
@@ -201,7 +201,7 @@ constexpr sycl::specialization_id same_name{11};
201201
// CHECK-NEXT: namespace detail {
202202
// CHECK-NEXT: template<>
203203
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
204-
// CHECK-NEXT: return ::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
204+
// CHECK-NEXT: return "";
205205
// CHECK-NEXT: }
206206
// CHECK-NEXT: // namespace detail
207207
// CHECK-NEXT: // namespace sycl
@@ -221,7 +221,7 @@ constexpr sycl::specialization_id same_name{12};
221221
// CHECK-NEXT: namespace detail {
222222
// CHECK-NEXT: template<>
223223
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
224-
// CHECK-NEXT: return ::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
224+
// CHECK-NEXT: return "";
225225
// CHECK-NEXT: }
226226
// CHECK-NEXT: // namespace detail
227227
// CHECK-NEXT: // namespace sycl
@@ -257,7 +257,7 @@ constexpr sycl::specialization_id same_name{13};
257257
// CHECK-NEXT: namespace detail {
258258
// CHECK-NEXT: template<>
259259
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID_2]]()>() {
260-
// CHECK-NEXT: return ::outer::__sycl_detail::__spec_id_shim_[[SHIM_ID_2]]();
260+
// CHECK-NEXT: return "";
261261
// CHECK-NEXT: }
262262
// CHECK-NEXT: // namespace detail
263263
// CHECK-NEXT: // namespace sycl
@@ -280,7 +280,7 @@ constexpr sycl::specialization_id same_name{14};
280280
// CHECK-NEXT: namespace detail {
281281
// CHECK-NEXT: template<>
282282
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
283-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
283+
// CHECK-NEXT: return "";
284284
// CHECK-NEXT: }
285285
// CHECK-NEXT: // namespace detail
286286
// CHECK-NEXT: // namespace sycl
@@ -309,7 +309,7 @@ constexpr sycl::specialization_id same_name{15};
309309
// CHECK-NEXT: namespace detail {
310310
// CHECK-NEXT: template<>
311311
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID2]]()>() {
312-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID2]]();
312+
// CHECK-NEXT: return "";
313313
// CHECK-NEXT: }
314314
// CHECK-NEXT: // namespace detail
315315
// CHECK-NEXT: // namespace sycl
@@ -337,7 +337,7 @@ constexpr sycl::specialization_id same_name{16};
337337
// CHECK-NEXT: namespace detail {
338338
// CHECK-NEXT: template<>
339339
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID2]]()>() {
340-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID2]]();
340+
// CHECK-NEXT: return "";
341341
// CHECK-NEXT: }
342342
// CHECK-NEXT: // namespace detail
343343
// CHECK-NEXT: // namespace sycl

clang/test/CodeGenSYCL/anonymous_integration_footer2.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ constexpr sycl::specialization_id same_name{207};
8383
// CHECK-NEXT: namespace detail {
8484
// CHECK-NEXT: template<>
8585
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
86-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
86+
// CHECK-NEXT: return "";
8787
// CHECK-NEXT: }
8888
// CHECK-NEXT: // namespace detail
8989
// CHECK-NEXT: // namespace sycl
@@ -102,7 +102,7 @@ constexpr sycl::specialization_id same_name{208};
102102
// CHECK-NEXT: namespace detail {
103103
// CHECK-NEXT: template<>
104104
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
105-
// CHECK-NEXT: return ::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
105+
// CHECK-NEXT: return "";
106106
// CHECK-NEXT: }
107107
// CHECK-NEXT: // namespace detail
108108
// CHECK-NEXT: // namespace sycl
@@ -127,7 +127,7 @@ constexpr sycl::specialization_id same_name{209};
127127
// CHECK-NEXT: namespace detail {
128128
// CHECK-NEXT: template<>
129129
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::outer::inner::__sycl_detail::__spec_id_shim_[[SHIM_ID]]()>() {
130-
// CHECK-NEXT: return ::outer::inner::__sycl_detail::__spec_id_shim_[[SHIM_ID]]();
130+
// CHECK-NEXT: return "";
131131
// CHECK-NEXT: }
132132
// CHECK-NEXT: // namespace detail
133133
// CHECK-NEXT: // namespace sycl

clang/test/CodeGenSYCL/integration_footer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ specialization_id<int> AnonNSSpecID;
136136
// CHECK-NEXT: namespace detail {
137137
// CHECK-NEXT: template<>
138138
// CHECK-NEXT: inline const char *get_spec_constant_symbolic_ID<::Foo::__sycl_detail::__spec_id_shim_[[SHIM0]]()>() {
139-
// CHECK-NEXT: return ::Foo::__sycl_detail::__spec_id_shim_[[SHIM0]]();
139+
// CHECK-NEXT: return "";
140140
// CHECK-NEXT: }
141141
// CHECK-NEXT: } // namespace detail
142142
// CHECK-NEXT: } // namespace sycl

0 commit comments

Comments
 (0)