Skip to content

Commit 1001c46

Browse files
committed
ASTDumper: Do not escape Unicode chars in quoted fields
Context: #68438 (comment)
1 parent 26e888e commit 1001c46

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

lib/AST/ASTDumper.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "swift/Basic/Defer.h"
3333
#include "swift/Basic/QuotedString.h"
3434
#include "swift/Basic/STLExtras.h"
35+
#include "swift/Basic/StringExtras.h"
3536
#include "clang/AST/Type.h"
3637
#include "llvm/ADT/APFloat.h"
3738
#include "llvm/ADT/SmallString.h"
@@ -180,7 +181,7 @@ class escaping_ostream : public raw_ostream {
180181

181182
private:
182183
virtual void write_impl(const char *Ptr, size_t Size) override {
183-
base_os.write_escaped(StringRef(Ptr, Size), /*UseHexEscapes=*/true);
184+
writeEscaped(StringRef(Ptr, Size), base_os);
184185
}
185186

186187
virtual uint64_t current_pos() const override {

test/Generics/minimal_conformances_compare_concrete.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ struct G<X> {}
1414
// CHECK-NEXT: Generic signature: <X where X == Derived>
1515
extension G where X : Base, X : P, X == Derived {}
1616

17-
// RULE: + (requirement "\xCF\x84_0_0" subclass_of "Base")
18-
// RULE: + (requirement "\xCF\x84_0_0" conforms_to "P")
19-
// RULE: + (requirement "\xCF\x84_0_0" same_type "Derived")
17+
// RULE: + (requirement "τ_0_0" subclass_of "Base")
18+
// RULE: + (requirement "τ_0_0" conforms_to "P")
19+
// RULE: + (requirement "τ_0_0" same_type "Derived")
2020

2121
// RULE: Rewrite system: {
2222
// RULE-NEXT: - [Copyable].[Copyable] => [Copyable] [permanent]

test/Parse/raw_string.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ _ = ##"""
7777
/// passes again.
7878
/// See https://github.com/apple/swift/issues/51192.
7979
_ = #"​"​"#
80-
// CHECK: "\xE2\x80\x8B\"\xE2\x80\x8B"
80+
// CHECK: "​\"​"
8181

8282
_ = #""""#
8383
// CHECK: "\"\""

unittests/AST/ASTDumperTests.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ TEST(ASTDumper, ArchetypeType) {
5252
}
5353

5454
EXPECT_EQ(str,
55-
" name=\"\\xCF\\x84_0_0\"\n"
55+
" name=\"τ_0_0\"\n"
5656
" (interface_type=generic_type_param_type depth=0 index=0 param_kind=type))\n");
5757
}

0 commit comments

Comments
 (0)