Skip to content

Commit 7841cf8

Browse files
Update source_location tests for upcoming EDG changes (#5551)
1 parent c83fbfd commit 7841cf8

File tree

2 files changed

+44
-35
lines changed

2 files changed

+44
-35
lines changed

tests/std/tests/P1208R6_source_location/header.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ constexpr void header_test() {
1818
assert(x.column() == 37);
1919
#endif // ^^^ C1XX ^^^
2020
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
21-
#ifdef __EDG__
22-
assert(x.function_name() == "void header_test()"sv);
23-
#else // ^^^ EDG / Other vvv
21+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
22+
assert(x.function_name() == "void __cdecl header_test(void)"sv || x.function_name() == "void header_test()"sv);
23+
#else // ^^^ workaround / no workaround vvv
2424
assert(x.function_name() == "void __cdecl header_test(void)"sv);
25-
#endif // ^^^ Other ^^^
25+
#endif // ^^^ no workaround ^^^
2626
#else // ^^^ detailed / basic vvv
2727
assert(x.function_name() == "header_test"sv);
2828
#endif // ^^^ basic ^^^

tests/std/tests/P1208R6_source_location/test.cpp

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ constexpr void local_test() {
6868
assert(x.column() == 37);
6969
#endif // ^^^ C1XX ^^^
7070
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
71-
#ifdef __EDG__
72-
assert(x.function_name() == "void local_test()"sv);
73-
#else // ^^^ EDG / Other vvv
71+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
72+
assert(x.function_name() == "void __cdecl local_test(void)"sv || x.function_name() == "void local_test()"sv);
73+
#else // ^^^ workaround / no workaround vvv
7474
assert(x.function_name() == "void __cdecl local_test(void)"sv);
75-
#endif // ^^^ Other ^^^
75+
#endif // ^^^ no workaround ^^^
7676
#else // ^^^ detailed / basic vvv
7777
assert(x.function_name() == "local_test"sv);
7878
#endif // ^^^ basic ^^^
@@ -84,11 +84,11 @@ constexpr void argument_test(
8484
assert(x.line() == line);
8585
assert(x.column() == column);
8686
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
87-
#ifdef __EDG__
88-
assert(x.function_name() == "bool test()"sv);
89-
#else // ^^^ EDG / Other vvv
87+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
88+
assert(x.function_name() == "bool __cdecl test(void)"sv || x.function_name() == "bool test()"sv);
89+
#else // ^^^ workaround / no workaround vvv
9090
assert(x.function_name() == "bool __cdecl test(void)"sv);
91-
#endif // ^^^ Other ^^^
91+
#endif // ^^^ no workaround ^^^
9292
#else // ^^^ detailed / basic vvv
9393
assert(x.function_name() == "test"sv);
9494
#endif // ^^^ basic ^^^
@@ -110,11 +110,12 @@ constexpr void sloc_constructor_test() {
110110
} else
111111
#endif // ^^^ workaround ^^^
112112
{
113-
#ifdef __EDG__
114-
assert(x.loc.function_name() == "void sloc_constructor_test()"sv);
115-
#else // ^^^ EDG / Other vvv
113+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
114+
assert(x.loc.function_name() == "void __cdecl sloc_constructor_test(void)"sv
115+
|| x.loc.function_name() == "void sloc_constructor_test()"sv);
116+
#else // ^^^ workaround / no workaround vvv
116117
assert(x.loc.function_name() == "void __cdecl sloc_constructor_test(void)"sv);
117-
#endif // ^^^ Other ^^^
118+
#endif // ^^^ no workaround ^^^
118119
}
119120
#else // ^^^ detailed / basic vvv
120121
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1285783
@@ -140,11 +141,11 @@ constexpr void different_constructor_test() {
140141
assert(x.loc.column() == 5);
141142
#endif // ^^^ C1XX ^^^
142143
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
143-
#ifdef __EDG__
144-
assert(x.loc.function_name() == "s::s(int)"sv);
145-
#else // ^^^ EDG / Other vvv
144+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
145+
assert(x.loc.function_name() == THISCALL_OR_CDECL " s::s(int)"sv || x.loc.function_name() == "s::s(int)"sv);
146+
#else // ^^^ workaround / no workaround vvv
146147
assert(x.loc.function_name() == THISCALL_OR_CDECL " s::s(int)"sv);
147-
#endif // ^^^ Other ^^^
148+
#endif // ^^^ no workaround ^^^
148149
#else // ^^^ detailed / basic vvv
149150
assert(x.loc.function_name() == "s"sv);
150151
#endif // ^^^ basic ^^^
@@ -166,11 +167,12 @@ constexpr void sub_member_test() {
166167
} else
167168
#endif // ^^^ workaround ^^^
168169
{
169-
#ifdef __EDG__
170-
assert(s.x.loc.function_name() == "void sub_member_test()"sv);
171-
#else // ^^^ EDG / Other vvv
170+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
171+
assert(s.x.loc.function_name() == "void __cdecl sub_member_test(void)"sv
172+
|| s.x.loc.function_name() == "void sub_member_test()"sv);
173+
#else // ^^^ workaround / no workaround vvv
172174
assert(s.x.loc.function_name() == "void __cdecl sub_member_test(void)"sv);
173-
#endif // ^^^ Other ^^^
175+
#endif // ^^^ no workaround ^^^
174176
}
175177
#else // ^^^ detailed / basic vvv
176178
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1285783
@@ -194,11 +196,12 @@ constexpr void sub_member_test() {
194196
assert(s_i.x.loc.column() == 5);
195197
#endif // ^^^ C1XX ^^^
196198
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
197-
#ifdef __EDG__
198-
assert(s_i.x.loc.function_name() == "s2::s2(int)"sv);
199-
#else // ^^^ EDG / Other vvv
199+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
200+
assert(s_i.x.loc.function_name() == THISCALL_OR_CDECL " s2::s2(int)"sv
201+
|| s_i.x.loc.function_name() == "s2::s2(int)"sv);
202+
#else // ^^^ workaround / no workaround vvv
200203
assert(s_i.x.loc.function_name() == THISCALL_OR_CDECL " s2::s2(int)"sv);
201-
#endif // ^^^ Other ^^^
204+
#endif // ^^^ no workaround ^^^
202205
#else // ^^^ detailed / basic vvv
203206
assert(s_i.x.loc.function_name() == "s2"sv);
204207
#endif // ^^^ basic ^^^
@@ -223,11 +226,11 @@ constexpr void lambda_test() {
223226
assert(x2.column() == 50);
224227
#endif // ^^^ C1XX ^^^
225228
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
226-
#ifdef __EDG__
227-
assert(x1.function_name() == "void lambda_test()"sv);
228-
#else // ^^^ EDG / Other vvv
229+
#ifdef __EDG__ // TRANSITION, EDG is changing to match C1XX's output
230+
assert(x1.function_name() == "void __cdecl lambda_test(void)"sv || x1.function_name() == "void lambda_test()"sv);
231+
#else // ^^^ workaround / no workaround vvv
229232
assert(x1.function_name() == "void __cdecl lambda_test(void)"sv);
230-
#endif // ^^^ Other ^^^
233+
#endif // ^^^ no workaround ^^^
231234
#else // ^^^ detailed / basic vvv
232235
assert(x1.function_name() == "lambda_test"sv);
233236
#endif // ^^^ basic ^^^
@@ -241,7 +244,9 @@ constexpr void lambda_test() {
241244
#elif defined(__clang__) // ^^^ basic / detailed Clang vvv
242245
assert(fun2 == "auto " THISCALL_OR_CDECL " lambda_test()::(anonymous class)::operator()(void) const"sv);
243246
#elif defined(__EDG__) // ^^^ detailed Clang / detailed __EDG__ vvv
244-
assert(fun2 == "lambda []()->auto::operator()()->auto"sv);
247+
// TRANSITION, EDG is changing to resemble C1XX's output somewhat more closely
248+
assert(fun2 == THISCALL_OR_CDECL " lambda [](void)->auto::operator()(void)->auto"sv
249+
|| fun2 == "lambda []()->auto::operator()()->auto"sv);
245250
#else // ^^^ detailed __EDG__ / detailed C1XX vvv
246251
assert(fun2.starts_with("struct std::source_location " THISCALL_OR_CDECL " lambda_test::<lambda_"sv));
247252
assert(fun2.ends_with("::operator ()(void) const"sv));
@@ -270,7 +275,9 @@ constexpr void function_template_test() {
270275
#elif defined(__clang__) // ^^^ basic / detailed Clang vvv
271276
assert(x1.function_name() == "source_location __cdecl function_template(void) [T = void]"sv);
272277
#elif defined(__EDG__) // ^^^ detailed Clang / detailed __EDG__ vvv
273-
assert(x1.function_name() == "std::source_location function_template<void>()"sv);
278+
// TRANSITION, EDG is changing to almost match C1XX's output
279+
assert(x1.function_name() == "std::source_location __cdecl function_template<void>(void)"sv
280+
|| x1.function_name() == "std::source_location function_template<void>()"sv);
274281
#else // ^^^ detailed __EDG__ / detailed C1XX vvv
275282
assert(x1.function_name() == "struct std::source_location __cdecl function_template<void>(void)"sv);
276283
#endif // ^^^ detailed C1XX ^^^
@@ -284,7 +291,9 @@ constexpr void function_template_test() {
284291
#elif defined(__clang__) // ^^^ basic / detailed Clang vvv
285292
assert(x2.function_name() == "source_location __cdecl function_template(void) [T = int]"sv);
286293
#elif defined(__EDG__) // ^^^ detailed Clang / detailed __EDG__ vvv
287-
assert(x2.function_name() == "std::source_location function_template<int>()"sv);
294+
// TRANSITION, EDG is changing to almost match C1XX's output
295+
assert(x2.function_name() == "std::source_location __cdecl function_template<int>(void)"sv
296+
|| x2.function_name() == "std::source_location function_template<int>()"sv);
288297
#else // ^^^ detailed __EDG__ / detailed C1XX vvv
289298
assert(x2.function_name() == "struct std::source_location __cdecl function_template<int>(void)"sv);
290299
#endif // ^^^ detailed C1XX ^^^

0 commit comments

Comments
 (0)