[Dependency Scanner] Do not escape strings in the scanner output

When outputting strings for things like filenames, using `write_escaped` will result in Unicode characters being outputted with a full 3-character-octal or hex escape. Clients which expect a UTF-8 JSON output will not be able to parse such escape sequences.
This commit is contained in:
Artem Chikin
2020-10-19 16:54:14 -07:00
parent 38c8bbd9a7
commit d7a6ded7aa
3 changed files with 20 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -scan-dependencies %s %S/Inputs/unicode_filёnamё.swift -o %t/deps.json
// Check the contents of the JSON output
// RUN: %FileCheck %s < %t/deps.json
print(foo())
// CHECK: "swift": "deps"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "modulePath": "deps.swiftmodule",
// CHECK-NEXT: "sourceFiles": [
// CHECK-NEXT: "{{.*}}ScanDependencies{{/|\\}}unicode_filename.swift",
// CHECK-NEXT: "{{.*}}ScanDependencies{{/|\\}}Inputs{{/|\\}}unicode_filёnamё.swift"
// CHECK-NEXT: ],