From c188910694ab821aabc0ca11f4636b69f5f7b4f1 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Nov 2022 10:18:57 -0700 Subject: [lldb][Test] Make TestFrameFormatNameWithArgs.test more compatible across platforms On Linux the `std::function` behaved differently to that on Darwin. This patch removes usage of `std::function` in the test but attempts to retain the test-coverage. We mainly want function types appearing in the template argument and function argument lists. Also add a `char const*` overload to one of the test functions to cover the "format function argument using ValueObject formatter" code-path. Differential Revision: https://reviews.llvm.org/D137272 --- lldb/test/Shell/Settings/Inputs/names.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'lldb/test/Shell/Settings/Inputs/names.cpp') diff --git a/lldb/test/Shell/Settings/Inputs/names.cpp b/lldb/test/Shell/Settings/Inputs/names.cpp index 461c6d091a0f..cf6982abb8f3 100644 --- a/lldb/test/Shell/Settings/Inputs/names.cpp +++ b/lldb/test/Shell/Settings/Inputs/names.cpp @@ -1,5 +1,3 @@ -#include - namespace detail { template struct Quux {}; } // namespace detail @@ -7,15 +5,16 @@ template struct Quux {}; using FuncPtr = detail::Quux (*(*)(int))(float); struct Foo { - template void foo(T const &t) const noexcept(true) {} + template void foo(T arg) const noexcept(true) {} - template void operator<<(size_t) {} + template void operator<<(int) {} template FuncPtr returns_func_ptr(detail::Quux &&) const noexcept(false) { return nullptr; } }; namespace ns { -template int foo(T const &t) noexcept(false) { return 0; } +template int foo(char const *str) noexcept(false) { return 0; } +template int foo(T t) { return 1; } template FuncPtr returns_func_ptr(detail::Quux &&) { return nullptr; } } // namespace ns @@ -24,20 +23,20 @@ int bar() { return 1; } namespace { int anon_bar() { return 1; } -auto anon_lambda = [](std::function) mutable {}; +auto anon_lambda = [] {}; } // namespace int main() { - ns::foo(bar); - ns::foo(std::function{bar}); + ns::foo(bar); + ns::foo("bar"); ns::foo(anon_lambda); - ns::foo(std::function{anon_bar}); - ns::foo(&Foo::foo>); + ns::foo(anon_bar); + ns::foo)>("method"); ns::returns_func_ptr(detail::Quux{}); Foo f; - f.foo(std::function{bar}); - f.foo(std::function{anon_bar}); + f.foo(anon_bar); f.operator<< <(2 > 1)>(0); f.returns_func_ptr(detail::Quux{}); + return 0; } -- cgit v1.2.3