Skip to content

Commit 17302d3

Browse files
committed
Address remaining comments
1 parent 44059b8 commit 17302d3

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,22 @@ class LibCXXFrameRecognizer : public StackFrameRecognizer {
6161
// std::__1::__function::__value_func<void ()>::operator()[abi:ne200000]() const
6262
RegularExpression{""
6363
R"(^std::__[^:]*::)" // Namespace.
64-
R"(__function::.*::operator\(\))"
65-
R"((\[.*\])?)" // ABI tag.
66-
R"(( const)?$)"}, // const.
64+
R"(__function::.*::operator\(\))"},
6765
// internal implementation details of std::function in ABI v2
6866
// std::__2::__function::__policy_invoker<void (int, int)>::__call_impl[abi:ne200000]<std::__2::__function::__default_alloc_func<int (*)(int, int), int (int, int)>>
6967
RegularExpression{""
7068
R"(^std::__[^:]*::)" // Namespace.
71-
R"(__function::.*::__call_impl)"
72-
R"((\[.*\])?)" // ABI tag.
73-
R"(<.*>)"}, // template argument.
69+
R"(__function::.*::__call_impl)"},
7470
// internal implementation details of std::invoke
7571
// std::__1::__invoke[abi:ne200000]<void (*&)()>
7672
RegularExpression{
7773
R"(^std::__[^:]*::)" // Namespace.
78-
R"(__invoke)"
79-
R"((\[.*\])?)" // ABI tag.
80-
R"(<.*>)"}, // template argument.
74+
R"(__invoke)"},
8175
// internal implementation details of std::invoke
8276
// std::__1::__invoke_void_return_wrapper<void, true>::__call[abi:ne200000]<void (*&)()>
8377
RegularExpression{
8478
R"(^std::__[^:]*::)" // Namespace.
85-
R"(__invoke_void_return_wrapper<.*>::__call)"
86-
R"((\[.*\])?)" // ABI tag.
87-
R"(<.*>)"} // template argument.
88-
79+
R"(__invoke_void_return_wrapper<.*>::__call)"}
8980
},
9081
m_hidden_frame(new LibCXXHiddenFrame()) {}
9182

lldb/test/API/lang/cpp/std-invoke-recognizer/TestStdInvokeRecognizer.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ def test_frame_recognizer(self):
1212
"""Test that implementation details of `std::invoke` are hidden"""
1313
self.build()
1414
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
15-
self, "// break here", lldb.SBFileSpec("main.cpp")
15+
self, "break here", lldb.SBFileSpec("main.cpp")
1616
)
1717

18+
stop_cnt = 0
1819
while process.GetState() != lldb.eStateExited:
20+
stop_cnt += 1
1921
self.assertTrue(
2022
any(
2123
f in thread.GetFrameAtIndex(0).GetFunctionName()
22-
for f in ["print_num", "add", "PrintAdder"]
24+
for f in ["consume_number", "add", "Callable"]
2325
)
2426
)
2527
# Skip all hidden frames
@@ -38,3 +40,5 @@ def test_frame_recognizer(self):
3840
"main", thread.GetFrameAtIndex(frame_id + 1).GetFunctionName()
3941
)
4042
process.Continue()
43+
44+
self.assertEqual(stop_cnt, 4)
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
11
#include <functional>
2-
#include <iostream>
32

4-
void print_num(int i) {
5-
// break here
6-
std::cout << i << '\n';
3+
void consume_number(int i) {
4+
__builtin_printf("break here");
75
}
86

97
int add(int i, int j) {
108
// break here
119
return i + j;
1210
}
1311

14-
struct PrintAdder {
15-
PrintAdder(int num) : num_(num) {}
12+
struct Callable {
13+
Callable(int num) : num_(num) {}
1614
void operator()(int i) const {
17-
// break here
18-
std::cout << i << '\n';
15+
__builtin_printf("break here");
1916
}
20-
void print_add(int i) const {
21-
// break here
22-
std::cout << num_ + i << '\n';
17+
void member_function(int i) const {
18+
__builtin_printf("break here");
2319
}
2420
int num_;
2521
};
2622

2723
int main() {
2824
// Invoke a void-returning function
29-
std::invoke(print_num, -9);
25+
std::invoke(consume_number, -9);
3026

3127
// Invoke a non-void-returning function
32-
std::cout << std::invoke(add, 1, 10) << '\n';
28+
std::invoke(add, 1, 10);
3329

3430
// Invoke a member function
35-
const PrintAdder foo(314159);
36-
std::invoke(&PrintAdder::print_add, foo, 1);
31+
const Callable foo(314159);
32+
std::invoke(&Callable::member_function, foo, 1);
3733

3834
// Invoke a function object
39-
std::invoke(PrintAdder(12), 18);
35+
std::invoke(Callable(12), 18);
4036
}

0 commit comments

Comments
 (0)