[all-commits] [llvm/llvm-project] d0bf48: [lldb][FormatEntity][NFC] Move function argument p...
Michael137 via All-commits
all-commits at lists.llvm.org
Mon Oct 31 05:25:47 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d0bf48c7b179027d978c479167e23825b8d0c4f6
https://github.com/llvm/llvm-project/commit/d0bf48c7b179027d978c479167e23825b8d0c4f6
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2022-10-31 (Mon, 31 Oct 2022)
Changed paths:
M lldb/include/lldb/Core/FormatEntity.h
M lldb/source/Core/FormatEntity.cpp
Log Message:
-----------
[lldb][FormatEntity][NFC] Move function argument parsing code into separate functions
Hopefully makes the code more readable and allows
us to re-use argument pretty-printing code from
the `CPlusPlusLanguage` plugin in a follow-up commit.
Differential Revision: https://reviews.llvm.org/D136934
Commit: 76f34ed2837880c1865202f28988b01c93ac4f89
https://github.com/llvm/llvm-project/commit/76f34ed2837880c1865202f28988b01c93ac4f89
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2022-10-31 (Mon, 31 Oct 2022)
Changed paths:
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
M lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
Log Message:
-----------
[lldb][CPlusPlus] Introduce CPlusPlusLanguage::MethodName::GetReturnType
This patch adds a way to extract the return type out
of the `CPlusPlusNameParser`. This will be useful
for cases where we want a function's basename *and* the
return type but not the function arguments; this is
currently not possible (the parser either gives us the
full name or just the basename). Since the parser knows
how to handle return types already we should just expose
this to users that need it.
**Testing**
* Added unit-tests
Differential Revision: https://reviews.llvm.org/D136935
Commit: 031096d04d09ac4a93859d161fb42d1a1b308253
https://github.com/llvm/llvm-project/commit/031096d04d09ac4a93859d161fb42d1a1b308253
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2022-10-31 (Mon, 31 Oct 2022)
Changed paths:
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
A lldb/test/Shell/Settings/Inputs/names.cpp
A lldb/test/Shell/Settings/TestFrameFormatNameWithArgs.test
Log Message:
-----------
[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
Compare: https://github.com/llvm/llvm-project/compare/66b830889d9b...031096d04d09
More information about the All-commits
mailing list