[AST] Introduce ASTMangler::forUSR

Rather than setting the USR-specific bits for each USR entrypoint
into the mangler just expose a convenience constructor for USR
generation that sets them.
This commit is contained in:
Hamish Knight
2025-10-23 09:11:17 +01:00
parent 28e0010dd6
commit b607ec7a2f
3 changed files with 12 additions and 9 deletions

View File

@@ -958,8 +958,6 @@ std::string ASTMangler::mangleTypeAsContextUSR(const NominalTypeDecl *type) {
}
std::string ASTMangler::mangleTypeAsUSR(Type Ty) {
DWARFMangling = true;
RespectOriginallyDefinedIn = false;
beginMangling();
Ty = getTypeForDWARFMangling(Ty);
@@ -1019,8 +1017,6 @@ ASTMangler::mangleAnyDecl(const ValueDecl *Decl,
std::string ASTMangler::mangleDeclAsUSR(const ValueDecl *Decl,
StringRef USRPrefix) {
llvm::SaveAndRestore<bool> respectOriginallyDefinedInRAII(
RespectOriginallyDefinedIn, false);
return (llvm::Twine(USRPrefix) + mangleAnyDecl(Decl, false)).str();
}
@@ -1029,8 +1025,6 @@ std::string ASTMangler::mangleAccessorEntityAsUSR(AccessorKind kind,
StringRef USRPrefix,
bool isStatic) {
beginManglingWithoutPrefix();
llvm::SaveAndRestore<bool> respectOriginallyDefinedInRAII(
RespectOriginallyDefinedIn, false);
llvm::SaveAndRestore<bool> allowUnnamedRAII(AllowNamelessEntities, true);
Buffer << USRPrefix;
appendAccessorEntity(getCodeForAccessorKind(kind), decl, isStatic);