Skip to content

[lldb][Language] Change GetFunctionDisplayName to take SymbolContext by reference #135536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lldb/include/lldb/Target/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Language : public PluginInterface {
// the reference has never been assigned
virtual bool IsUninitializedReference(ValueObject &valobj);

virtual bool GetFunctionDisplayName(const SymbolContext *sc,
virtual bool GetFunctionDisplayName(const SymbolContext &sc,
const ExecutionContext *exe_ctx,
FunctionNameRepresentation representation,
Stream &s);
Expand Down
7 changes: 4 additions & 3 deletions lldb/source/Core/FormatEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,

if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss);
*sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss);

if (language_plugin_handled) {
s << ss.GetString();
Expand Down Expand Up @@ -1754,7 +1754,7 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,

if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs,
*sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithNoArgs,
ss);

if (language_plugin_handled) {
Expand Down Expand Up @@ -1789,7 +1789,8 @@ bool FormatEntity::Format(const Entry &entry, Stream &s,

if (language_plugin)
language_plugin_handled = language_plugin->GetFunctionDisplayName(
sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss);
*sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs,
ss);

if (language_plugin_handled) {
s << ss.GetString();
Expand Down
12 changes: 5 additions & 7 deletions lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class CPlusPlusLanguage : public Language {
ConstString
GetDemangledFunctionNameWithoutArguments(Mangled mangled) const override;

bool GetFunctionDisplayName(const SymbolContext *sc,
bool GetFunctionDisplayName(const SymbolContext &sc,
const ExecutionContext *exe_ctx,
FunctionNameRepresentation representation,
Stream &s) override;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Target/Language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ bool Language::IsNilReference(ValueObject &valobj) { return false; }

bool Language::IsUninitializedReference(ValueObject &valobj) { return false; }

bool Language::GetFunctionDisplayName(const SymbolContext *sc,
bool Language::GetFunctionDisplayName(const SymbolContext &sc,
const ExecutionContext *exe_ctx,
FunctionNameRepresentation representation,
Stream &s) {
Expand Down
Loading