Skip to content

Commit 81a564a

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

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 2 additions & 1 deletion
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 {

unittests/AST/ASTDumperTests.cpp

Lines changed: 1 addition & 1 deletion
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)