From 52e45a79ad24f8a2347a5566e6abaa207918df62 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Sun, 13 Apr 2025 23:19:26 +0100 Subject: [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. --- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp') 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; -- cgit v1.1