Skip to content

Mangler: Use llvm::SaveAndRestore to save/restore generic signature #27093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,9 @@ void ASTMangler::appendOpaqueDeclName(const OpaqueTypeDecl *opaqueDecl) {
if (canSymbolicReference(opaqueDecl)) {
appendSymbolicReference(opaqueDecl);
} else if (auto namingDecl = opaqueDecl->getNamingDecl()) {
CanGenericSignature savedSignature = CurGenericSignature;
llvm::SaveAndRestore<CanGenericSignature> savedSignature(
CurGenericSignature);
appendEntity(namingDecl);
CurGenericSignature = savedSignature;
appendOperator("QO");
} else {
llvm_unreachable("todo: independent opaque type decls");
Expand Down Expand Up @@ -2667,11 +2667,11 @@ void ASTMangler::appendConcreteProtocolConformance(
opaqueSignature->getConformanceAccessPath(opaqueTypeParam, proto);

// Append the conformance access path with the signature of the opaque type.
CanGenericSignature savedSignature = CurGenericSignature;
CurGenericSignature = opaqueSignature->getCanonicalSignature();
appendDependentProtocolConformance(conformanceAccessPath);
CurGenericSignature = savedSignature;

{
llvm::SaveAndRestore<CanGenericSignature> savedSignature(
CurGenericSignature, opaqueSignature->getCanonicalSignature());
appendDependentProtocolConformance(conformanceAccessPath);
}
appendType(canType);
appendOperator("HO");
} else {
Expand Down