[ASTMangler] Pass ASTContext to all instantiations of ASTMangler

This commit is contained in:
Kuba Mracek
2024-10-17 11:37:38 -07:00
parent 30cf6472af
commit 6f4ae28520
88 changed files with 335 additions and 315 deletions

View File

@@ -2797,7 +2797,7 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) {
auto *dwfi = cast<DifferentiabilityWitnessFunctionInst>(&SI);
auto *witness = dwfi->getWitness();
DifferentiabilityWitnessesToEmit.insert(witness);
Mangle::ASTMangler mangler;
Mangle::ASTMangler mangler(witness->getOriginalFunction()->getASTContext());
auto mangledKey = mangler.mangleSILDifferentiabilityWitness(
witness->getOriginalFunction()->getName(), witness->getKind(),
witness->getConfig());
@@ -2985,7 +2985,7 @@ void SILSerializer::writeSILVTable(const SILVTable &vt) {
// Use the mangled name of the class as a key to distinguish between classes
// which have the same name (but are in different contexts).
Mangle::ASTMangler mangler;
Mangle::ASTMangler mangler(vt.getClass()->getASTContext());
std::string mangledClassName = mangler.mangleNominalType(vt.getClass());
size_t nameLength = mangledClassName.size();
char *stringStorage = (char *)StringTable.Allocate(nameLength, 1);
@@ -3036,7 +3036,7 @@ void SILSerializer::writeSILMoveOnlyDeinit(const SILMoveOnlyDeinit &deinit) {
// Use the mangled name of the class as a key to distinguish between classes
// which have the same name (but are in different contexts).
Mangle::ASTMangler mangler;
Mangle::ASTMangler mangler(deinit.getNominalDecl()->getASTContext());
std::string mangledNominalName =
mangler.mangleNominalType(deinit.getNominalDecl());
size_t nameLength = mangledNominalName.size();
@@ -3261,7 +3261,7 @@ writeSILDefaultWitnessTable(const SILDefaultWitnessTable &wt) {
void SILSerializer::writeSILDifferentiabilityWitness(
const SILDifferentiabilityWitness &dw) {
Mangle::ASTMangler mangler;
Mangle::ASTMangler mangler(dw.getOriginalFunction()->getASTContext());
auto mangledKey = mangler.mangleSILDifferentiabilityWitness(
dw.getOriginalFunction()->getName(), dw.getKind(), dw.getConfig());
size_t nameLength = mangledKey.size();