2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
5
- // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5
+ // Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
6
6
// Licensed under Apache License v2.0 with Runtime Library Exception
7
7
//
8
8
// See https://swift.org/LICENSE.txt for license information
@@ -35,6 +35,11 @@ namespace Demangle {
35
35
36
36
enum class SymbolicReferenceKind : uint8_t ;
37
37
38
+ // / A simple default implementation that assigns letters to archetypes in
39
+ // / alphabetic order.
40
+ std::string archetypeName (uint64_t index, uint64_t depth);
41
+
42
+ // / Display style options for the demangler.
38
43
struct DemangleOptions {
39
44
bool SynthesizeSugarOnTypes = false ;
40
45
bool DisplayDebuggerGeneratedModule = true ;
@@ -52,6 +57,7 @@ struct DemangleOptions {
52
57
bool ShortenArchetype = false ;
53
58
bool ShowPrivateDiscriminators = true ;
54
59
bool ShowFunctionArgumentTypes = true ;
60
+ std::function<std::string(uint64_t , uint64_t )> ArchetypeName = archetypeName;
55
61
56
62
DemangleOptions () {}
57
63
@@ -346,17 +352,19 @@ class Context {
346
352
// / prefix: _T, _T0, $S, _$S.
347
353
// /
348
354
// / \returns The demangled string.
349
- std::string demangleSymbolAsString (llvm::StringRef MangledName,
350
- const DemangleOptions &Options = DemangleOptions());
355
+ std::string demangleSymbolAsString (
356
+ llvm::StringRef MangledName,
357
+ const DemangleOptions &Options = DemangleOptions());
351
358
352
359
// / Demangle the given type and return the readable name.
353
360
// /
354
361
// / \param MangledName The mangled type string, which does _not_ start with
355
362
// / a mangling prefix.
356
363
// /
357
364
// / \returns The demangled string.
358
- std::string demangleTypeAsString (llvm::StringRef MangledName,
359
- const DemangleOptions &Options = DemangleOptions());
365
+ std::string
366
+ demangleTypeAsString (llvm::StringRef MangledName,
367
+ const DemangleOptions &Options = DemangleOptions());
360
368
361
369
// / Returns true if the mangledName refers to a thunk function.
362
370
// /
@@ -571,7 +579,6 @@ bool nodeConsumesGenericArgs(Node *node);
571
579
bool isSpecialized (Node *node);
572
580
573
581
NodePointer getUnspecialized (Node *node, NodeFactory &Factory);
574
- std::string archetypeName (Node::IndexType index, Node::IndexType depth);
575
582
576
583
// / Form a StringRef around the mangled name starting at base, if the name may
577
584
// / contain symbolic references.
0 commit comments