22//
33// This source file is part of the Swift.org open source project
44//
5- // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+ // Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
66// Licensed under Apache License v2.0 with Runtime Library Exception
77//
88// See https://swift.org/LICENSE.txt for license information
@@ -35,6 +35,11 @@ namespace Demangle {
3535
3636enum class SymbolicReferenceKind : uint8_t ;
3737
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.
3843struct DemangleOptions {
3944 bool SynthesizeSugarOnTypes = false ;
4045 bool DisplayDebuggerGeneratedModule = true ;
@@ -52,6 +57,7 @@ struct DemangleOptions {
5257 bool ShortenArchetype = false ;
5358 bool ShowPrivateDiscriminators = true ;
5459 bool ShowFunctionArgumentTypes = true ;
60+ std::function<std::string(uint64_t , uint64_t )> ArchetypeName = archetypeName;
5561
5662 DemangleOptions () {}
5763
@@ -346,17 +352,19 @@ class Context {
346352 // / prefix: _T, _T0, $S, _$S.
347353 // /
348354 // / \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());
351358
352359 // / Demangle the given type and return the readable name.
353360 // /
354361 // / \param MangledName The mangled type string, which does _not_ start with
355362 // / a mangling prefix.
356363 // /
357364 // / \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());
360368
361369 // / Returns true if the mangledName refers to a thunk function.
362370 // /
@@ -584,7 +592,6 @@ bool nodeConsumesGenericArgs(Node *node);
584592bool isSpecialized (Node *node);
585593
586594NodePointer getUnspecialized (Node *node, NodeFactory &Factory);
587- std::string archetypeName (Node::IndexType index, Node::IndexType depth);
588595
589596// / Returns true if the node \p kind refers to a context node, e.g. a nominal
590597// / type or a function.
0 commit comments