Skip to content

Commit 2b90ad1

Browse files
committed
ASTMangler: Don't optimize protocol names in debugger mangling
1 parent c14cbe0 commit 2b90ad1

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,13 @@ std::string ASTMangler::mangleTypeForDebugger(Type Ty, const DeclContext *DC) {
365365
"mangling type for debugger", Ty);
366366

367367
DWARFMangling = true;
368+
OptimizeProtocolNames = false;
368369
beginMangling();
369370

370371
if (DC)
371372
bindGenericParameters(DC);
372373

373-
if (auto *fnType = Ty->getAs<AnyFunctionType>()) {
374-
appendFunction(fnType, false);
375-
} else {
376-
appendType(Ty);
377-
}
378-
374+
appendType(Ty);
379375
appendOperator("D");
380376
return finalize();
381377
}

lib/AST/Module.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,8 @@ TypeDecl *SourceFile::lookupLocalType(llvm::StringRef mangledName) const {
570570
ASTContext &ctx = getASTContext();
571571
for (auto typeDecl : LocalTypeDecls) {
572572
auto typeMangledName = evaluateOrDefault(ctx.evaluator,
573-
USRGenerationRequest { typeDecl },
573+
MangleLocalTypeDeclRequest { typeDecl },
574574
std::string());
575-
if (typeMangledName.find("s:") == 0)
576-
typeMangledName = typeMangledName.substr(2);
577-
578575
if (mangledName == typeMangledName)
579576
return typeDecl;
580577
}

lib/Serialization/Serialization.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "swift/AST/PrettyStackTrace.h"
2727
#include "swift/AST/ProtocolConformance.h"
2828
#include "swift/AST/RawComment.h"
29+
#include "swift/AST/TypeCheckRequests.h"
2930
#include "swift/Basic/Dwarf.h"
3031
#include "swift/Basic/FileSystem.h"
3132
#include "swift/Basic/STLExtras.h"
@@ -4638,7 +4639,10 @@ void Serializer::writeAST(ModuleOrSourceFile DC,
46384639
for (auto TD : localTypeDecls) {
46394640
hasLocalTypes = true;
46404641
Mangle::ASTMangler Mangler;
4641-
std::string MangledName = Mangler.mangleDeclAsUSR(TD, /*USRPrefix*/"");
4642+
std::string MangledName =
4643+
evaluateOrDefault(M->getASTContext().evaluator,
4644+
MangleLocalTypeDeclRequest { TD },
4645+
std::string());
46424646
assert(!MangledName.empty() && "Mangled type came back empty!");
46434647
localTypeGenerator.insert(MangledName, addDeclRef(TD));
46444648

test/DebugInfo/archetype.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ func ExistentialTuple<T: RandomAccessIndex>(_ x: T, y: T) -> T.Distance {
2222
return _overflowChecked((tmp.0, tmp.1))
2323
}
2424
// CHECK: ![[TT]] = !DICompositeType(tag: DW_TAG_structure_type,
25-
// CHECK-SAME: name: "$s8DistanceQz_SbtD"
25+
// CHECK-SAME: name: "$s8Distance9archetype17RandomAccessIndexPQz_SbtD"
2626

0 commit comments

Comments
 (0)