Skip to content

New mangling: fix a bug in debug-info type mangling and enable testing it (by comparing with the old mangling) #6960

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
Jan 21, 2017
Merged
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
20 changes: 8 additions & 12 deletions lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,21 @@ using namespace swift;
using namespace swift::NewMangling;

std::string NewMangling::mangleTypeForDebugger(Type Ty, const DeclContext *DC) {
if (useNewMangling()) {
ASTMangler NewMangler(/* DWARF */ true);
return NewMangler.mangleTypeForDebugger(Ty, DC);
}
Mangle::Mangler OldMangler(/* DWARF */ true);
OldMangler.mangleTypeForDebugger(Ty, DC);
return OldMangler.finalize();
std::string Old = OldMangler.finalize();
ASTMangler NewMangler(/* DWARF */ true);
std::string New = NewMangler.mangleTypeForDebugger(Ty, DC);
return selectMangling(Old, New);
}

std::string NewMangling::mangleTypeAsUSR(Type Ty) {
if (useNewMangling()) {
ASTMangler NewMangler;
return NewMangler.mangleTypeAsUSR(Ty);
}
Mangle::Mangler OldMangler;
OldMangler.mangleType(Ty, /*uncurry*/ 0);
return OldMangler.finalize();
std::string Old = OldMangler.finalize();
ASTMangler NewMangler;
std::string New = NewMangler.mangleTypeAsUSR(Ty);
return selectMangling(Old, New);
}


Expand Down Expand Up @@ -593,8 +591,6 @@ void ASTMangler::appendType(Type type) {
auto GTPT = DC->mapTypeOutOfContext(archetype)
->castTo<GenericTypeParamType>();

Buffer << 'q' << Index(GTPT->getIndex());

// The DWARF output created by Swift is intentionally flat,
// therefore archetypes are emitted with their DeclContext if
// they appear at the top level of a type.
Expand Down