Skip to content

Commit c612a7a

Browse files
committed
Revert "Swift: deduplicate accessors and params correctly"
This reverts commit bab4eee.
1 parent 1d32f6e commit c612a7a

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

swift/extractor/mangler/SwiftMangler.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,16 @@ SwiftMangledName SwiftMangler::visitValueDecl(const swift::ValueDecl* decl, bool
6565
auto ret = initMangled(decl);
6666
std::string name;
6767
llvm::raw_string_ostream oss{name};
68-
oss << decl->getName();
68+
decl->getName().print(oss);
6969
ret << name;
7070
if (decl->isStatic()) {
7171
ret << "|static";
7272
}
7373
return ret;
7474
}
7575

76-
SwiftMangledName SwiftMangler::visitTypeDiscriminatedValueDecl(const swift::ValueDecl* decl,
77-
bool force) {
78-
if (auto ret = visitValueDecl(decl, force)) {
76+
SwiftMangledName SwiftMangler::visitTypeDiscriminatedValueDecl(const swift::ValueDecl* decl) {
77+
if (auto ret = visitValueDecl(decl)) {
7978
ret << fetch(decl->getInterfaceType()->getCanonicalType());
8079
return ret;
8180
}
@@ -86,13 +85,6 @@ SwiftMangledName SwiftMangler::visitAbstractFunctionDecl(const swift::AbstractFu
8685
return visitTypeDiscriminatedValueDecl(decl);
8786
}
8887

89-
SwiftMangledName SwiftMangler::visitAccessorDecl(const swift::AccessorDecl* decl) {
90-
std::string name;
91-
llvm::raw_string_ostream oss{name};
92-
decl->printUserFacingName(oss);
93-
return visitTypeDiscriminatedValueDecl(decl, /*force=*/true) << '_' << name;
94-
}
95-
9688
SwiftMangledName SwiftMangler::visitSubscriptDecl(const swift::SubscriptDecl* decl) {
9789
return visitTypeDiscriminatedValueDecl(decl);
9890
}
@@ -101,10 +93,6 @@ SwiftMangledName SwiftMangler::visitVarDecl(const swift::VarDecl* decl) {
10193
return visitTypeDiscriminatedValueDecl(decl);
10294
}
10395

104-
SwiftMangledName SwiftMangler::visitParamDecl(const swift::ParamDecl* decl) {
105-
return visitTypeDiscriminatedValueDecl(decl, /*force=*/true);
106-
}
107-
10896
SwiftMangledName SwiftMangler::visitExtensionDecl(const swift::ExtensionDecl* decl) {
10997
if (decl->getDeclContext()->isLocalContext()) {
11098
return {};

swift/extractor/mangler/SwiftMangler.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ class SwiftMangler : private swift::TypeVisitor<SwiftMangler, SwiftMangledName>,
5858
SwiftMangledName visitModuleDecl(const swift::ModuleDecl* decl);
5959
SwiftMangledName visitExtensionDecl(const swift::ExtensionDecl* decl);
6060
SwiftMangledName visitAbstractFunctionDecl(const swift::AbstractFunctionDecl* decl);
61-
SwiftMangledName visitAccessorDecl(const swift::AccessorDecl* decl);
6261
SwiftMangledName visitSubscriptDecl(const swift::SubscriptDecl* decl);
6362
SwiftMangledName visitVarDecl(const swift::VarDecl* decl);
64-
SwiftMangledName visitParamDecl(const swift::ParamDecl* decl);
6563
SwiftMangledName visitAbstractTypeParamDecl(const swift::AbstractTypeParamDecl* decl);
6664
SwiftMangledName visitGenericTypeParamDecl(const swift::GenericTypeParamDecl* decl);
6765

@@ -113,8 +111,7 @@ class SwiftMangler : private swift::TypeVisitor<SwiftMangler, SwiftMangledName>,
113111
unsigned int getExtensionIndex(const swift::ExtensionDecl* decl, const swift::Decl* parent);
114112
static SwiftMangledName initMangled(const swift::TypeBase* type);
115113
SwiftMangledName initMangled(const swift::Decl* decl);
116-
SwiftMangledName visitTypeDiscriminatedValueDecl(const swift::ValueDecl* decl,
117-
bool force = false);
114+
SwiftMangledName visitTypeDiscriminatedValueDecl(const swift::ValueDecl* decl);
118115
};
119116

120117
// This implementation is indented for use in defining trap keys. In this case fetching gives

0 commit comments

Comments
 (0)