With this commit, we also hide the implementation details of `std::invoke`. To do so, the `LibCXXFrameRecognizer` got a couple more regular expressions. The regular expression passed into `AddRecognizer` became problematic, as it was evaluated on the demangled name. Those names also included result types for C++ symbols. For `std::__invoke` the return type is a huge `decltype(...)`, making the regular expresison really hard to write. Instead, I added support to `AddRecognizer` for matching on the demangled names without result type and argument types. By hiding the implementation details of `invoke`, also the back traces for `std::function` become even nicer, because `std::function` is using `__invoke` internally. Co-authored-by: Adrian Prantl <aprantl@apple.com>
31 lines
688 B
C++
31 lines
688 B
C++
#include <functional>
|
|
|
|
void consume_number(int i) { __builtin_printf("break here"); }
|
|
|
|
int add(int i, int j) {
|
|
// break here
|
|
return i + j;
|
|
}
|
|
|
|
struct Callable {
|
|
Callable(int num) : num_(num) {}
|
|
void operator()(int i) const { __builtin_printf("break here"); }
|
|
void member_function(int i) const { __builtin_printf("break here"); }
|
|
int num_;
|
|
};
|
|
|
|
int main() {
|
|
// Invoke a void-returning function
|
|
std::invoke(consume_number, -9);
|
|
|
|
// Invoke a non-void-returning function
|
|
std::invoke(add, 1, 10);
|
|
|
|
// Invoke a member function
|
|
const Callable foo(314159);
|
|
std::invoke(&Callable::member_function, foo, 1);
|
|
|
|
// Invoke a function object
|
|
std::invoke(Callable(12), 18);
|
|
}
|