Skip to content

Commit 47078b4

Browse files
committed
Mangler: Use llvm::SaveAndRestore to save/restore generic signature
NFC
1 parent 656fe89 commit 47078b4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,9 @@ void ASTMangler::appendOpaqueDeclName(const OpaqueTypeDecl *opaqueDecl) {
736736
if (canSymbolicReference(opaqueDecl)) {
737737
appendSymbolicReference(opaqueDecl);
738738
} else if (auto namingDecl = opaqueDecl->getNamingDecl()) {
739-
CanGenericSignature savedSignature = CurGenericSignature;
739+
llvm::SaveAndRestore<CanGenericSignature> savedSignature(
740+
CurGenericSignature);
740741
appendEntity(namingDecl);
741-
CurGenericSignature = savedSignature;
742742
appendOperator("QO");
743743
} else {
744744
llvm_unreachable("todo: independent opaque type decls");
@@ -2667,11 +2667,11 @@ void ASTMangler::appendConcreteProtocolConformance(
26672667
opaqueSignature->getConformanceAccessPath(opaqueTypeParam, proto);
26682668

26692669
// Append the conformance access path with the signature of the opaque type.
2670-
CanGenericSignature savedSignature = CurGenericSignature;
2671-
CurGenericSignature = opaqueSignature->getCanonicalSignature();
2672-
appendDependentProtocolConformance(conformanceAccessPath);
2673-
CurGenericSignature = savedSignature;
2674-
2670+
{
2671+
llvm::SaveAndRestore<CanGenericSignature> savedSignature(
2672+
CurGenericSignature, opaqueSignature->getCanonicalSignature());
2673+
appendDependentProtocolConformance(conformanceAccessPath);
2674+
}
26752675
appendType(canType);
26762676
appendOperator("HO");
26772677
} else {

0 commit comments

Comments
 (0)