Skip to content

[lldb] Add GetMangledTypeName to TypeSystem/CompilerType #113006

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 1 commit into from
Oct 19, 2024
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: 2 additions & 0 deletions lldb/include/lldb/Symbol/CompilerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ class CompilerType {

ConstString GetDisplayTypeName() const;

ConstString GetMangledTypeName() const;

uint32_t
GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;

Expand Down
4 changes: 4 additions & 0 deletions lldb/include/lldb/Symbol/TypeSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ class TypeSystem : public PluginInterface,

virtual ConstString GetDisplayTypeName(lldb::opaque_compiler_type_t type) = 0;

// Defaults to GetTypeName(type). Override if your language desires
// specialized behavior.
Comment on lines +240 to +241
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: these should be /// doxygen style comments.

virtual ConstString GetMangledTypeName(lldb::opaque_compiler_type_t type);

virtual uint32_t
GetTypeInfo(lldb::opaque_compiler_type_t type,
CompilerType *pointee_or_element_compiler_type) = 0;
Expand Down
8 changes: 8 additions & 0 deletions lldb/source/Symbol/CompilerType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ ConstString CompilerType::GetDisplayTypeName() const {
return ConstString("<invalid>");
}

ConstString CompilerType::GetMangledTypeName() const {
if (IsValid()) {
if (auto type_system_sp = GetTypeSystem())
return type_system_sp->GetMangledTypeName(m_type);
}
return ConstString("<invalid>");
}

uint32_t CompilerType::GetTypeInfo(
CompilerType *pointee_or_element_compiler_type) const {
if (IsValid())
Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Symbol/TypeSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ bool TypeSystem::IsMeaninglessWithoutDynamicResolution(void *type) {
return false;
}

ConstString TypeSystem::GetMangledTypeName(void *type) {
return GetTypeName(type, false);
}

ConstString TypeSystem::DeclGetMangledName(void *opaque_decl) {
return ConstString();
}
Expand Down
Loading