Skip to content

Commit 169096c

Browse files
committed
[AST] Rename mangleDeclAsUSR -> mangleDeclWithPrefix
This is used by other things that don't necessarily want an IDE USR.
1 parent a1e1656 commit 169096c

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

include/swift/AST/ASTMangler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class ASTMangler : public Mangler {
399399

400400
void appendAnyDecl(const ValueDecl *Decl);
401401
std::string mangleAnyDecl(const ValueDecl *decl, bool addPrefix);
402-
std::string mangleDeclAsUSR(const ValueDecl *Decl, StringRef USRPrefix);
402+
std::string mangleDeclWithPrefix(const ValueDecl *decl, StringRef prefix);
403403

404404
std::string mangleAccessorEntityAsUSR(AccessorKind kind,
405405
const AbstractStorageDecl *decl,

lib/AST/ASTMangler.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,10 +1011,9 @@ std::string ASTMangler::mangleAnyDecl(const ValueDecl *decl, bool addPrefix) {
10111011
return finalize();
10121012
}
10131013

1014-
std::string ASTMangler::mangleDeclAsUSR(const ValueDecl *Decl,
1015-
StringRef USRPrefix) {
1016-
return (llvm::Twine(USRPrefix) + mangleAnyDecl(Decl, /*addPrefix*/ false))
1017-
.str();
1014+
std::string ASTMangler::mangleDeclWithPrefix(const ValueDecl *decl,
1015+
StringRef prefix) {
1016+
return (llvm::Twine(prefix) + mangleAnyDecl(decl, /*addPrefix*/ false)).str();
10181017
}
10191018

10201019
std::string ASTMangler::mangleAccessorEntityAsUSR(AccessorKind kind,

lib/AST/USRGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ swift::SwiftUSRGenerationRequest::evaluate(Evaluator &evaluator,
248248

249249
using namespace Mangle;
250250
ASTMangler NewMangler = ASTMangler::forUSR(D->getASTContext());
251-
return NewMangler.mangleDeclAsUSR(D, getUSRSpacePrefix());
251+
return NewMangler.mangleDeclWithPrefix(D, getUSRSpacePrefix());
252252
}
253253

254254
std::string

lib/ClangImporter/SwiftDeclSynthesizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ getAccessorDeclarationName(clang::ASTContext &Ctx, NominalTypeDecl *structDecl,
998998
std::string id;
999999
llvm::raw_string_ostream IdStream(id);
10001000
Mangle::ASTMangler mangler(structDecl->getASTContext());
1001-
IdStream << "$" << mangler.mangleDeclAsUSR(structDecl, "") << "$"
1001+
IdStream << "$" << mangler.mangleDeclWithPrefix(structDecl, "") << "$"
10021002
<< fieldDecl->getName() << "$" << suffix;
10031003

10041004
return clang::DeclarationName(&Ctx.Idents.get(IdStream.str()));

lib/Serialization/ModuleFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ void ModuleFile::loadDerivativeFunctionConfigurations(
753753
return;
754754
auto &ctx = originalAFD->getASTContext();
755755
Mangle::ASTMangler Mangler(ctx);
756-
auto mangledName = Mangler.mangleDeclAsUSR(originalAFD, "");
756+
auto mangledName = Mangler.mangleDeclWithPrefix(originalAFD, "");
757757
auto configs = Core->DerivativeFunctionConfigurations->find(mangledName);
758758
if (configs == Core->DerivativeFunctionConfigurations->end())
759759
return;

lib/Serialization/Serialization.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6897,14 +6897,15 @@ static void recordDerivativeFunctionConfig(
68976897
auto &ctx = AFD->getASTContext();
68986898
Mangle::ASTMangler Mangler(AFD->getASTContext());
68996899
for (auto *attr : AFD->getAttrs().getAttributes<DifferentiableAttr>()) {
6900-
auto mangledName = ctx.getIdentifier(Mangler.mangleDeclAsUSR(AFD, ""));
6900+
auto mangledName = ctx.getIdentifier(Mangler.mangleDeclWithPrefix(AFD, ""));
69016901
derivativeConfigs[mangledName].insert(
69026902
{ctx.getIdentifier(attr->getParameterIndices()->getString()),
69036903
attr->getDerivativeGenericSignature()});
69046904
}
69056905
for (auto *attr : AFD->getAttrs().getAttributes<DerivativeAttr>()) {
69066906
auto *origAFD = attr->getOriginalFunction(ctx);
6907-
auto mangledName = ctx.getIdentifier(Mangler.mangleDeclAsUSR(origAFD, ""));
6907+
auto mangledName =
6908+
ctx.getIdentifier(Mangler.mangleDeclWithPrefix(origAFD, ""));
69086909
derivativeConfigs[mangledName].insert(
69096910
{ctx.getIdentifier(attr->getParameterIndices()->getString()),
69106911
AFD->getGenericSignature()});

0 commit comments

Comments
 (0)