Skip to content

Commit 2e56083

Browse files
committed
[IDE] Switch to using symbol names for reconstructing types
This is closer to what the debugger and USRs will look like, and includes more context needed in some cases.
1 parent 99ee073 commit 2e56083

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

test/IDE/reconstruct_type_from_mangled_name.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ struct MyGenStruct1<T, U: StringLiteralConvertible, V: Sequence> {
8181
// CHECK: reconstructed decl from usr for 'y' is 'let y: U'
8282
let z: V
8383
// CHECK: reconstructed decl from usr for 'z' is 'let z: V'
84+
85+
func test000() {
86+
_ = x
87+
// CHECK: reconstructed type from usr for 'x' is 'T'
88+
_ = y
89+
// CHECK: reconstructed type from usr for 'y' is 'U'
90+
_ = z
91+
// CHECK: reconstructed type from usr for 'z' is 'V'
92+
}
8493
}
8594

8695
let genstruct1 = MyGenStruct1<Int, String, [Float]>(x: 1, y: "", z: [1.0])

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,10 +2389,10 @@ class TypeReconstructWalker : public SourceEntityWalker {
23892389
return true;
23902390
T = T->getRValueType();
23912391
Mangle::Mangler Man(/* DWARFMangling */true);
2392-
Man.mangleType(T, 0);
2392+
Man.mangleTypeForDebugger(T, D->getDeclContext());
23932393
std::string MangledName(Man.finalize());
23942394
std::string Error;
2395-
Type ReconstructedType = getTypeFromMangledTypename(Ctx, MangledName,
2395+
Type ReconstructedType = getTypeFromMangledSymbolname(Ctx, MangledName,
23962396
Error);
23972397
if (ReconstructedType) {
23982398
Stream << "reconstructed type from usr for '" << Range.str() << "' is '";

0 commit comments

Comments
 (0)