Skip to content

Commit 789646a

Browse files
committed
Demangling: Make demangled names more readable and further reduce the size of the simplified demangled names
The goal here is to make the short demangling as short and readable as possible, also at the cost of omitting some information. The assumption is that whenever the short demangling is displayed, there is a way for the user to also get the full demangled name if needed. *) omit <where ...> because it does not give useful information anyway Deserializer.deserialize<A where ...> () throws -> [A] --> Deserializer.deserialize<A> () throws -> [A] *) for multiple specialized functions only emit a single “specialized” specialized specialized Constructible.create(A.Element) -> Constructible<A> --> specialized Constructible.create(A.Element) -> Constructible<A> *) Don’t print function argument types: foo(Int, Double, named: Int) --> foo(_:_:named:) This is a trade-off, because it can lead to ambiguity if there are overloads with different types. *) make contexts of closures, local functions, etc. more readable by using “<a> in <b>” syntax This is also done for the full and not only for the simplified demangling. Renderer.(renderInlines([Inline]) -> String).(closure #1) --> closure #1 in Renderer.renderInlines *) change spacing, so that it matches our coding style: foo <A> (x : A) --> foo<A>(x: A)
1 parent 66d9533 commit 789646a

37 files changed

+1118
-1074
lines changed

include/swift/Demangling/Demangle.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ namespace Demangle {
3434

3535
struct DemangleOptions {
3636
bool SynthesizeSugarOnTypes = false;
37-
bool DisplayTypeOfIVarFieldOffset = true;
3837
bool DisplayDebuggerGeneratedModule = true;
3938
bool QualifyEntities = true;
4039
bool DisplayExtensionContexts = true;
@@ -49,6 +48,7 @@ struct DemangleOptions {
4948
bool ShortenValueWitness = false;
5049
bool ShortenArchetype = false;
5150
bool ShowPrivateDiscriminators = true;
51+
bool ShowFunctionArgumentTypes = true;
5252

5353
DemangleOptions() {}
5454

@@ -68,6 +68,7 @@ struct DemangleOptions {
6868
Opt.ShortenValueWitness = true;
6969
Opt.ShortenArchetype = true;
7070
Opt.ShowPrivateDiscriminators = false;
71+
Opt.ShowFunctionArgumentTypes = false;
7172
return Opt;
7273
};
7374
};

0 commit comments

Comments
 (0)