Skip to content

Commit ef115cf

Browse files
committed
Rename swift::Demangle::archetypeName() to swift::Demangle::genericParameterName().
1 parent 4ca9852 commit ef115cf

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

include/swift/Demangling/Demangle.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ namespace Demangle {
3535

3636
enum class SymbolicReferenceKind : uint8_t;
3737

38-
/// A simple default implementation that assigns letters to archetypes in
38+
/// A simple default implementation that assigns letters to type parameters in
3939
/// alphabetic order.
40-
std::string archetypeName(uint64_t index, uint64_t depth);
40+
std::string genericParameterName(uint64_t depth, uint64_t index);
4141

4242
/// Display style options for the demangler.
4343
struct DemangleOptions {
@@ -57,7 +57,8 @@ struct DemangleOptions {
5757
bool ShortenArchetype = false;
5858
bool ShowPrivateDiscriminators = true;
5959
bool ShowFunctionArgumentTypes = true;
60-
std::function<std::string(uint64_t, uint64_t)> ArchetypeName = archetypeName;
60+
std::function<std::string(uint64_t, uint64_t)> GenericParameterName =
61+
genericParameterName;
6162

6263
DemangleOptions() {}
6364

lib/Demangling/NodePrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ DemanglerPrinter &DemanglerPrinter::operator<<(long long n) & {
5050
return *this;
5151
}
5252

53-
std::string Demangle::archetypeName(uint64_t index, uint64_t depth) {
53+
std::string Demangle::genericParameterName(uint64_t depth, uint64_t index) {
5454
DemanglerPrinter name;
5555
do {
5656
name << (char)('A' + (index % 26));
@@ -1958,7 +1958,7 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
19581958
}
19591959
// FIXME: Depth won't match when a generic signature applies to a
19601960
// method in generic type context.
1961-
Printer << Options.ArchetypeName(index, depth);
1961+
Printer << Options.GenericParameterName(depth, index);
19621962
}
19631963
}
19641964

@@ -2036,7 +2036,7 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
20362036
case Node::Kind::DependentGenericParamType: {
20372037
unsigned index = Node->getChild(1)->getIndex();
20382038
unsigned depth = Node->getChild(0)->getIndex();
2039-
Printer << Options.ArchetypeName(index, depth);
2039+
Printer << Options.GenericParameterName(depth, index);
20402040
return nullptr;
20412041
}
20422042
case Node::Kind::DependentGenericType: {

lib/Demangling/OldDemangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ class OldDemangler {
13741374

13751375
NodePointer getDependentGenericParamType(unsigned depth, unsigned index) {
13761376
DemanglerPrinter PrintName;
1377-
PrintName << archetypeName(index, depth);
1377+
PrintName << genericParameterName(depth, index);
13781378

13791379
auto paramTy = Factory.createNode(Node::Kind::DependentGenericParamType);
13801380
paramTy->addChild(Factory.createNode(Node::Kind::Index, depth), Factory);

unittests/Basic/DemangleTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ TEST(Demangle, IsObjCSymbol) {
3232
EXPECT_EQ(true, isObjCSymbol(llvm::StringRef("_$sSC3fooyS2d_SdtFTO")));
3333
}
3434

35-
TEST(Demangle, CustomArchetypes) {
35+
TEST(Demangle, CustomGenericParameterNames) {
3636
std::string SymbolName = "_$s1a1gyq_q__xt_tr0_lF";
3737
std::string DemangledName = "a.g<Q, U>((U, Q)) -> U";
3838

3939
DemangleOptions Options;
40-
Options.ArchetypeName = [](uint64_t index, uint64_t depth) {
40+
Options.GenericParameterName = [](uint64_t depth, uint64_t index) {
4141
return index ? "U" : "Q";
4242
};
4343
std::string Result = demangleSymbolAsString(SymbolName, Options);

0 commit comments

Comments
 (0)