aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2025-04-13 23:19:26 +0100
committerGitHub <noreply@github.com>2025-04-13 23:19:26 +0100
commit52e45a79ad24f8a2347a5566e6abaa207918df62 (patch)
treed8b18525b13e9d0f7aa0626db21b0710691e200d /lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
parentcbe8f3ad7621e402b050e768f400ff0d19c3aedd (diff)
downloadllvm-52e45a79ad24f8a2347a5566e6abaa207918df62.zip
llvm-52e45a79ad24f8a2347a5566e6abaa207918df62.tar.gz
llvm-52e45a79ad24f8a2347a5566e6abaa207918df62.tar.bz2
[lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference (#135536)
Both the `CPlusPlusLanguage` plugins and the Swift language plugin already assume the `sc != nullptr`. And all `FormatEntity` callsites of `GetFunctionDisplayName` already check for nullptr before passing `sc`. This patch makes this pre-condition explicit by changing the parameter to `const SymbolContext &`. This will help with some upcoming changes in this area.
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp')
-rw-r--r--lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index a6fdf66..8c05f09 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -1757,20 +1757,18 @@ static bool PrintFunctionNameWithArgs(Stream &s,
}
bool CPlusPlusLanguage::GetFunctionDisplayName(
- const SymbolContext *sc, const ExecutionContext *exe_ctx,
+ const SymbolContext &sc, const ExecutionContext *exe_ctx,
FunctionNameRepresentation representation, Stream &s) {
switch (representation) {
case FunctionNameRepresentation::eNameWithArgs: {
- assert(sc);
-
// Print the function name with arguments in it
- if (sc->function)
- return PrintFunctionNameWithArgs(s, exe_ctx, *sc);
+ if (sc.function)
+ return PrintFunctionNameWithArgs(s, exe_ctx, sc);
- if (!sc->symbol)
+ if (!sc.symbol)
return false;
- const char *cstr = sc->symbol->GetName().AsCString(nullptr);
+ const char *cstr = sc.symbol->GetName().AsCString(nullptr);
if (!cstr)
return false;