mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Remove respectOriginallyDefinedIn parameter from mangleAnyDecl
This was always set to `true` except for USR mangling, where we already have it set to `false` for IDE USRs. The other clients were: - AutoDiff, which is just using the resulting string as a dictionary key, so don't seem to have any preference. - The ClangImporter, which always overrides `@_originallyDefinedIn` anyway.
This commit is contained in:
@@ -398,8 +398,7 @@ public:
|
||||
std::string mangleTypeAsContextUSR(const NominalTypeDecl *type);
|
||||
|
||||
void appendAnyDecl(const ValueDecl *Decl);
|
||||
std::string mangleAnyDecl(const ValueDecl *Decl, bool prefix,
|
||||
bool respectOriginallyDefinedIn = false);
|
||||
std::string mangleAnyDecl(const ValueDecl *decl, bool addPrefix);
|
||||
std::string mangleDeclAsUSR(const ValueDecl *Decl, StringRef USRPrefix);
|
||||
|
||||
std::string mangleAccessorEntityAsUSR(AccessorKind kind,
|
||||
|
||||
@@ -1120,8 +1120,7 @@ static StringRef calculateMangledName(SDKContext &Ctx, ValueDecl *VD) {
|
||||
return Ctx.buffer(attr->Name);
|
||||
}
|
||||
Mangle::ASTMangler NewMangler(VD->getASTContext());
|
||||
return Ctx.buffer(NewMangler.mangleAnyDecl(VD, true,
|
||||
/*bool respectOriginallyDefinedIn*/true));
|
||||
return Ctx.buffer(NewMangler.mangleAnyDecl(VD, /*addPrefix*/ true));
|
||||
}
|
||||
|
||||
static StringRef calculateLocation(SDKContext &SDKCtx, Decl *D) {
|
||||
|
||||
@@ -993,31 +993,28 @@ void ASTMangler::appendAnyDecl(const ValueDecl *Decl) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
ASTMangler::mangleAnyDecl(const ValueDecl *Decl,
|
||||
bool prefix,
|
||||
bool respectOriginallyDefinedIn) {
|
||||
std::string ASTMangler::mangleAnyDecl(const ValueDecl *decl, bool addPrefix) {
|
||||
DWARFMangling = true;
|
||||
RespectOriginallyDefinedIn = respectOriginallyDefinedIn;
|
||||
if (prefix) {
|
||||
if (addPrefix) {
|
||||
beginMangling();
|
||||
} else {
|
||||
beginManglingWithoutPrefix();
|
||||
}
|
||||
llvm::SaveAndRestore<bool> allowUnnamedRAII(AllowNamelessEntities, true);
|
||||
|
||||
appendAnyDecl(Decl);
|
||||
appendAnyDecl(decl);
|
||||
|
||||
// We have a custom prefix, so finalize() won't verify for us. If we're not
|
||||
// in invalid code (coming from an IDE caller) verify manually.
|
||||
if (CONDITIONAL_ASSERT_enabled() && !prefix && !Decl->isInvalid())
|
||||
if (CONDITIONAL_ASSERT_enabled() && !addPrefix && !decl->isInvalid())
|
||||
verify(Storage.str(), Flavor);
|
||||
return finalize();
|
||||
}
|
||||
|
||||
std::string ASTMangler::mangleDeclAsUSR(const ValueDecl *Decl,
|
||||
StringRef USRPrefix) {
|
||||
return (llvm::Twine(USRPrefix) + mangleAnyDecl(Decl, false)).str();
|
||||
return (llvm::Twine(USRPrefix) + mangleAnyDecl(Decl, /*addPrefix*/ false))
|
||||
.str();
|
||||
}
|
||||
|
||||
std::string ASTMangler::mangleAccessorEntityAsUSR(AccessorKind kind,
|
||||
|
||||
@@ -1348,9 +1348,9 @@ void PrintAST::printAttributes(const Decl *D) {
|
||||
if (Options.PrintSyntheticSILGenName
|
||||
&& !D->getAttrs().hasAttribute<SILGenNameAttr>()) {
|
||||
if (canPrintSyntheticSILGenName(D)) {
|
||||
auto mangledName = Mangle::ASTMangler(D->getASTContext())
|
||||
.mangleAnyDecl(cast<ValueDecl>(D), /*prefix=*/true,
|
||||
/*respectOriginallyDefinedIn=*/true);
|
||||
auto mangledName =
|
||||
Mangle::ASTMangler(D->getASTContext())
|
||||
.mangleAnyDecl(cast<ValueDecl>(D), /*addPrefix*/ true);
|
||||
Printer.printAttrName("@_silgen_name");
|
||||
Printer << "(";
|
||||
Printer.printEscapedStringLiteral(mangledName);
|
||||
|
||||
@@ -155,8 +155,7 @@ static std::string getMangledNameString(const Decl *D) {
|
||||
if (!VD)
|
||||
return std::string();
|
||||
Mangle::ASTMangler mangler(VD->getASTContext());
|
||||
return mangler.mangleAnyDecl(VD, /*prefix=*/true,
|
||||
/*respectOriginallyDefinedIn=*/true);
|
||||
return mangler.mangleAnyDecl(VD, /*addPrefix*/ true);
|
||||
}
|
||||
|
||||
static std::string getTypeString(const ValueDecl *VD) {
|
||||
|
||||
Reference in New Issue
Block a user