Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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.
- Loading branch information
Showing
3 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
func foo() { | ||
print(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ], |