Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<source_location>: Remove EDG workaround for DevCom-10199227 #4939

Merged
merged 7 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions stl/inc/source_location
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ _STL_DISABLE_CLANG_WARNINGS
#undef new

#ifndef _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__ // TRANSITION, DevCom-10199227
#define _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION 0
#else // ^^^ workaround / no workaround vvv
#define _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION 1
#endif // ^^^ no workaround ^^^
#endif // ^^^ !defined(_USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION) ^^^

_STD_BEGIN
Expand Down
14 changes: 4 additions & 10 deletions tests/std/include/test_header_units_and_modules.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,17 +743,11 @@ constexpr bool impl_test_source_location() {
assert(sl.line() == __LINE__ - 1);
assert(sl.column() == 38);

#ifdef __EDG__ // TRANSITION, DevCom-10199227
#define TEST_DETAILED_FUNCTION_NAME 0
#else // ^^^ workaround / no workaround vvv
#define TEST_DETAILED_FUNCTION_NAME 1
#endif // ^^^ no workaround ^^^

#if TEST_DETAILED_FUNCTION_NAME
#ifdef __EDG__
assert(sl.function_name() == "bool impl_test_source_location()"sv);
#else // ^^^ EDG / Other vvv
assert(sl.function_name() == "bool __cdecl impl_test_source_location(void)"sv);
#else // ^^^ detailed / basic vvv
assert(sl.function_name() == "impl_test_source_location"sv);
#endif // ^^^ basic ^^^
#endif // ^^^ Other ^^^

assert(string_view{sl.file_name()}.ends_with("test_header_units_and_modules.hpp"sv));
return true;
Expand Down
3 changes: 3 additions & 0 deletions tests/std/tests/P1208R6_source_location/env.lst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_20_matrix.lst
RUNALL_CROSSLIST
* PM_CL=""
* PM_CL="/D_USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION=0"
4 changes: 4 additions & 0 deletions tests/std/tests/P1208R6_source_location/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ constexpr void header_test() {
assert(x.column() == 37);
#endif // ^^^ C1XX ^^^
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__
assert(x.function_name() == "void header_test()"sv);
#else // ^^^ EDG / Other vvv
assert(x.function_name() == "void __cdecl header_test(void)"sv);
#endif // ^^^ Other ^^^
#else // ^^^ detailed / basic vvv
assert(x.function_name() == "header_test"sv);
#endif // ^^^ basic ^^^
Expand Down
68 changes: 60 additions & 8 deletions tests/std/tests/P1208R6_source_location/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ constexpr void local_test() {
assert(x.column() == 37);
#endif // ^^^ C1XX ^^^
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__
assert(x.function_name() == "void local_test()"sv);
#else // ^^^ EDG / Other vvv
assert(x.function_name() == "void __cdecl local_test(void)"sv);
#endif // ^^^ Other ^^^
#else // ^^^ detailed / basic vvv
assert(x.function_name() == "local_test"sv);
#endif // ^^^ basic ^^^
Expand All @@ -80,7 +84,11 @@ constexpr void argument_test(
assert(x.line() == line);
assert(x.column() == column);
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__
assert(x.function_name() == "bool test()"sv);
#else // ^^^ EDG / Other vvv
assert(x.function_name() == "bool __cdecl test(void)"sv);
#endif // ^^^ Other ^^^
#else // ^^^ detailed / basic vvv
assert(x.function_name() == "test"sv);
#endif // ^^^ basic ^^^
Expand All @@ -102,10 +110,21 @@ constexpr void sloc_constructor_test() {
} else
#endif // ^^^ workaround ^^^
{
#ifdef __EDG__
assert(x.loc.function_name() == "void sloc_constructor_test()"sv);
#else // ^^^ EDG / Other vvv
assert(x.loc.function_name() == "void __cdecl sloc_constructor_test(void)"sv);
#endif // ^^^ Other ^^^
}
#else // ^^^ detailed / basic vvv
assert(x.loc.function_name() == "sloc_constructor_test"sv);
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1285783
if (is_constant_evaluated()) {
assert(x.loc.function_name() == "main"sv);
} else
#endif // ^^^ workaround ^^^
{
assert(x.loc.function_name() == "sloc_constructor_test"sv);
CaseyCarter marked this conversation as resolved.
Show resolved Hide resolved
}
#endif // ^^^ basic ^^^
assert(string_view{x.loc.file_name()}.ends_with(test_cpp));
}
Expand All @@ -121,7 +140,11 @@ constexpr void different_constructor_test() {
assert(x.loc.column() == 5);
#endif // ^^^ C1XX ^^^
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__
assert(x.loc.function_name() == "s::s(int)"sv);
#else // ^^^ EDG / Other vvv
assert(x.loc.function_name() == THISCALL_OR_CDECL " s::s(int)"sv);
#endif // ^^^ Other ^^^
#else // ^^^ detailed / basic vvv
assert(x.loc.function_name() == "s"sv);
#endif // ^^^ basic ^^^
Expand All @@ -143,10 +166,21 @@ constexpr void sub_member_test() {
} else
#endif // ^^^ workaround ^^^
{
#ifdef __EDG__
assert(s.x.loc.function_name() == "void sub_member_test()"sv);
#else // ^^^ EDG / Other vvv
assert(s.x.loc.function_name() == "void __cdecl sub_member_test(void)"sv);
#endif // ^^^ Other ^^^
}
#else // ^^^ detailed / basic vvv
assert(s.x.loc.function_name() == "sub_member_test"sv);
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, VSO-1285783
if (is_constant_evaluated()) {
assert(s.x.loc.function_name() == "main"sv);
} else
#endif // ^^^ workaround ^^^
{
assert(s.x.loc.function_name() == "sub_member_test"sv);
CaseyCarter marked this conversation as resolved.
Show resolved Hide resolved
}
#endif // ^^^ basic ^^^
assert(string_view{s.x.loc.file_name()}.ends_with(test_cpp));

Expand All @@ -160,7 +194,11 @@ constexpr void sub_member_test() {
assert(s_i.x.loc.column() == 5);
#endif // ^^^ C1XX ^^^
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__
assert(s_i.x.loc.function_name() == "s2::s2(int)"sv);
#else // ^^^ EDG / Other vvv
assert(s_i.x.loc.function_name() == THISCALL_OR_CDECL " s2::s2(int)"sv);
#endif // ^^^ Other ^^^
#else // ^^^ detailed / basic vvv
assert(s_i.x.loc.function_name() == "s2"sv);
#endif // ^^^ basic ^^^
Expand All @@ -185,19 +223,29 @@ constexpr void lambda_test() {
assert(x2.column() == 50);
#endif // ^^^ C1XX ^^^
#if _USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#ifdef __EDG__
assert(x1.function_name() == "void lambda_test()"sv);
#else // ^^^ EDG / Other vvv
assert(x1.function_name() == "void __cdecl lambda_test(void)"sv);
#endif // ^^^ Other ^^^
#else // ^^^ detailed / basic vvv
assert(x1.function_name() == "lambda_test"sv);
#endif // ^^^ basic ^^^
const string_view fun2{x2.function_name()};
#if !_USE_DETAILED_FUNCTION_NAME_IN_SOURCE_LOCATION
#if !defined(__clang__) && !defined(__EDG__)
assert(fun2 == "operator ()"sv);
#else // ^^^ C1XX / Other vvv
assert(fun2 == "operator()"sv);
#endif // ^^^ Other ^^^
#elif defined(__clang__) // ^^^ basic / detailed Clang vvv
assert(fun2 == "auto " THISCALL_OR_CDECL " lambda_test()::(anonymous class)::operator()(void) const"sv);
#else // ^^^ detailed Clang / detailed non-Clang vvv
#elif defined(__EDG__) // ^^^ detailed Clang / detailed __EDG__ vvv
assert(fun2 == "lambda []()->auto::operator()()->auto"sv);
#else // ^^^ detailed __EDG__ / detailed C1XX vvv
assert(fun2.starts_with("struct std::source_location " THISCALL_OR_CDECL " lambda_test::<lambda_"sv));
assert(fun2.ends_with("::operator ()(void) const"sv));
#endif // ^^^ detailed non-Clang ^^^
#endif // ^^^ detailed C1XX ^^^
assert(string_view{x1.file_name()}.ends_with(test_cpp));
assert(string_view{x2.file_name()}.ends_with(test_cpp));
}
Expand All @@ -221,9 +269,11 @@ constexpr void function_template_test() {
assert(x1.function_name() == "function_template"sv);
#elif defined(__clang__) // ^^^ basic / detailed Clang vvv
assert(x1.function_name() == "source_location __cdecl function_template(void) [T = void]"sv);
#else // ^^^ detailed Clang / detailed non-Clang vvv
#elif defined(__EDG__) // ^^^ detailed Clang / detailed __EDG__ vvv
assert(x1.function_name() == "std::source_location function_template<void>()"sv);
#else // ^^^ detailed __EDG__ / detailed C1XX vvv
assert(x1.function_name() == "struct std::source_location __cdecl function_template<void>(void)"sv);
#endif // ^^^ detailed non-Clang ^^^
#endif // ^^^ detailed C1XX ^^^
assert(string_view{x1.file_name()}.ends_with(test_cpp));

const auto x2 = function_template<int>();
Expand All @@ -233,9 +283,11 @@ constexpr void function_template_test() {
assert(x2.function_name() == "function_template"sv);
#elif defined(__clang__) // ^^^ basic / detailed Clang vvv
assert(x2.function_name() == "source_location __cdecl function_template(void) [T = int]"sv);
#else // ^^^ detailed Clang / detailed non-Clang vvv
#elif defined(__EDG__) // ^^^ detailed Clang / detailed __EDG__ vvv
assert(x2.function_name() == "std::source_location function_template<int>()"sv);
#else // ^^^ detailed __EDG__ / detailed C1XX vvv
assert(x2.function_name() == "struct std::source_location __cdecl function_template<int>(void)"sv);
#endif // ^^^ detailed non-Clang ^^^
#endif // ^^^ detailed C1XX ^^^
assert(string_view{x1.file_name()} == string_view{x2.file_name()});
}

Expand Down