Skip to content

[lldb] Remove string demangling from DemangleCanonicalType #4038

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

Open
wants to merge 1 commit into
base: stable/20211026
Choose a base branch
from
Open
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
13 changes: 11 additions & 2 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1820,8 +1820,17 @@ TypeSystemSwiftTypeRef::RemangleAsType(swift::Demangle::Demangler &dem,
swift::Demangle::NodePointer TypeSystemSwiftTypeRef::DemangleCanonicalType(
swift::Demangle::Demangler &dem, opaque_compiler_type_t opaque_type) {
using namespace swift::Demangle;
CompilerType type = GetCanonicalType(opaque_type);
return GetDemangledType(dem, type.GetMangledTypeName().GetStringRef());
NodePointer canonical =
GetCanonicalDemangleTree(dem, AsMangledName(opaque_type));
if (ContainsUnresolvedTypeAlias(canonical)) {
// If this is a typealias defined in the expression evaluator,
// then we don't have debug info to resolve it from.
CompilerType ast_type =
ReconstructType({this, opaque_type}).GetCanonicalType();
canonical = GetCanonicalDemangleTree(
dem, ast_type.GetMangledTypeName().GetStringRef());
Comment on lines +1825 to +1831
Copy link
Author

Choose a reason for hiding this comment

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

this logic was inlined (copied) from GetCanonicalType in the same file.

Choose a reason for hiding this comment

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

Should it be a static helper maybe?

}
return GetType(canonical);
}

bool TypeSystemSwiftTypeRef::IsArrayType(opaque_compiler_type_t type,
Expand Down