Skip to content

Commit 0030a77

Browse files
authored
Merge pull request #19856 from akyrtzi/swift-format-fix
[swift-format] Fix issue with swift-format invocation re-using source buffers from previous iterations
2 parents 2f4b9e6 + 7bef733 commit 0030a77

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

test/swift-format/main.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// REQUIRES: rdar39260564
2-
31
// RUN: %swift-format %s >%t.response
42
// RUN: diff -u %s.response %t.response
53
// RUN: %swift-format -indent-width 2 %s >%t.response

tools/driver/swift_format_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class SwiftFormatInvocation {
211211
Formatted = "";
212212

213213
Output.replace(Offset, Length, Formatted);
214-
Doc.updateCode(llvm::MemoryBuffer::getMemBuffer(Output));
214+
Doc.updateCode(llvm::MemoryBuffer::getMemBufferCopy(Output));
215215
}
216216
if (Filename == "-" || (!InPlace && OutputFilename == "-")) {
217217
llvm::outs() << Output;

0 commit comments

Comments
 (0)