diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2022-10-27 11:10:28 +0100 |
---|---|---|
committer | Michael Buch <michaelbuch12@gmail.com> | 2022-10-31 12:25:19 +0000 |
commit | 031096d04d09ac4a93859d161fb42d1a1b308253 (patch) | |
tree | 50643c002abec40b2e83a5c51e46746bbf698ee0 /llvm/unittests/Support/ProgramTest.cpp | |
parent | 76f34ed2837880c1865202f28988b01c93ac4f89 (diff) | |
download | llvm-031096d04d09ac4a93859d161fb42d1a1b308253.zip llvm-031096d04d09ac4a93859d161fb42d1a1b308253.tar.gz llvm-031096d04d09ac4a93859d161fb42d1a1b308253.tar.bz2 |
[lldb][CPlusPlus] Implement CPlusPlusLanguage::GetFunctionDisplayName
This patch implements the `GetFunctionDisplayName` API which gets
used by the frame-formatting code to decide how to print a
function name.
Currently this API trivially returns `false`, so we try to parse
the demangled function base-name by hand. We try find the closing
parenthesis by doing a forward scan through the demangled name. However,
for arguments that contain parenthesis (e.g., function pointers)
this would leave garbage in the frame function name.
By re-using the `CPlusPlusLanguage` parser for this we offload the
need to parse function names to a component that knows how to do this
already.
We leave the existing parsing code in `FormatEntity` since it's used
in cases where a language-plugin is not available (and is not
necessarily C++ specific).
**Example**
For following function:
```
int foo(std::function<int(void)> const& func) { return 1; }
```
Before patch:
```
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() )> const&) at sample.cpp:11:49
```
After patch:
```
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() ) at sample.cpp:11:49
```
**Testing**
* Added shell test
Diffstat (limited to 'llvm/unittests/Support/ProgramTest.cpp')
0 files changed, 0 insertions, 0 deletions