Skip to content

Commit 48d96fd

Browse files
committed
[AST] Make DiagnosticTransaction non-copyable
1 parent eafa51d commit 48d96fd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/swift/AST/DiagnosticEngine.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,9 @@ namespace swift {
871871
bool IsOpen = true;
872872

873873
public:
874+
DiagnosticTransaction(const DiagnosticTransaction &) = delete;
875+
DiagnosticTransaction &operator=(const DiagnosticTransaction &) = delete;
876+
874877
explicit DiagnosticTransaction(DiagnosticEngine &engine)
875878
: Engine(engine),
876879
PrevDiagnostics(Engine.TentativeDiagnostics.size()),

lib/Sema/DerivedConformanceCodable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ ValueDecl *DerivedConformance::deriveEncodable(ValueDecl *requirement) {
11791179
// diagnostics, then potentially collect notes. If we succeed in
11801180
// synthesizing Encodable, we can cancel the transaction and get rid of the
11811181
// fake failures.
1182-
auto diagnosticTransaction = DiagnosticTransaction(TC.Context.Diags);
1182+
DiagnosticTransaction diagnosticTransaction(TC.Context.Diags);
11831183
TC.diagnose(ConformanceDecl, diag::type_does_not_conform,
11841184
Nominal->getDeclaredType(), getProtocolType());
11851185
TC.diagnose(requirement, diag::no_witnesses, diag::RequirementKind::Func,
@@ -1215,7 +1215,7 @@ ValueDecl *DerivedConformance::deriveDecodable(ValueDecl *requirement) {
12151215
// diagnostics produced by canSynthesize and deriveDecodable_init to produce
12161216
// them in the right order -- see the comment in deriveEncodable for
12171217
// background on this transaction.
1218-
auto diagnosticTransaction = DiagnosticTransaction(TC.Context.Diags);
1218+
DiagnosticTransaction diagnosticTransaction(TC.Context.Diags);
12191219
TC.diagnose(ConformanceDecl->getLoc(), diag::type_does_not_conform,
12201220
Nominal->getDeclaredType(), getProtocolType());
12211221
TC.diagnose(requirement, diag::no_witnesses,

0 commit comments

Comments
 (0)