Skip to content
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

[lldb] Consult Language plugin in GetDisplayDemangledName #90294

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Apr 26, 2024

Give language plugins the opportunity to provide a language specific display name.

This will be used in a follow up commit. The purpose of this change is to ultimately display breakpoint locations with a more human friendly demangling of Swift symbols.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 26, 2024

@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/90294.diff

2 Files Affected:

  • (modified) lldb/include/lldb/Target/Language.h (+4)
  • (modified) lldb/source/Core/Mangled.cpp (+2)
diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h
index 67714e6fdf942e..ff7c60bf68bfc9 100644
--- a/lldb/include/lldb/Target/Language.h
+++ b/lldb/include/lldb/Target/Language.h
@@ -281,6 +281,10 @@ class Language : public PluginInterface {
     return mangled.GetMangledName();
   }
 
+  virtual ConstString GetDisplayDemangledName(Mangled mangled) const {
+    return mangled.GetDemangledName();
+  }
+
   virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on,
                                                Stream &s);
 
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp
index b167c51fdce247..8efc4c639cca5f 100644
--- a/lldb/source/Core/Mangled.cpp
+++ b/lldb/source/Core/Mangled.cpp
@@ -310,6 +310,8 @@ ConstString Mangled::GetDemangledName() const {
 }
 
 ConstString Mangled::GetDisplayDemangledName() const {
+  if (Language *lang = Language::FindPlugin(GuessLanguage()))
+    return lang->GetDisplayDemangledName(*this);
   return GetDemangledName();
 }
 

@kastiglione kastiglione merged commit b52160d into llvm:main May 8, 2024
6 checks passed
@kastiglione kastiglione deleted the lldb-Consult-Language-plugin-in-GetDisplayDemangledName branch May 8, 2024 20:07
kastiglione added a commit to apple/llvm-project that referenced this pull request May 9, 2024
Give language plugins the opportunity to provide a language specific
display name.

This will be used in a follow up commit. The purpose of this change is
to ultimately display breakpoint locations with a more human friendly
demangling of Swift symbols.

(cherry picked from commit b52160d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants