ASTDumper: Do not escape Unicode chars in quoted fields

Context: https://github.com/swiftlang/swift/pull/68438#discussion_r1449272860
This commit is contained in:
Anthony Latsis
2024-12-07 18:36:47 +00:00
parent 26e888e45e
commit 1001c46e4c
4 changed files with 7 additions and 6 deletions

View File

@@ -32,6 +32,7 @@
#include "swift/Basic/Defer.h"
#include "swift/Basic/QuotedString.h"
#include "swift/Basic/STLExtras.h"
#include "swift/Basic/StringExtras.h"
#include "clang/AST/Type.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallString.h"
@@ -180,7 +181,7 @@ public:
private:
virtual void write_impl(const char *Ptr, size_t Size) override {
base_os.write_escaped(StringRef(Ptr, Size), /*UseHexEscapes=*/true);
writeEscaped(StringRef(Ptr, Size), base_os);
}
virtual uint64_t current_pos() const override {

View File

@@ -14,9 +14,9 @@ struct G<X> {}
// CHECK-NEXT: Generic signature: <X where X == Derived>
extension G where X : Base, X : P, X == Derived {}
// RULE: + (requirement "\xCF\x84_0_0" subclass_of "Base")
// RULE: + (requirement "\xCF\x84_0_0" conforms_to "P")
// RULE: + (requirement "\xCF\x84_0_0" same_type "Derived")
// RULE: + (requirement "τ_0_0" subclass_of "Base")
// RULE: + (requirement "τ_0_0" conforms_to "P")
// RULE: + (requirement "τ_0_0" same_type "Derived")
// RULE: Rewrite system: {
// RULE-NEXT: - [Copyable].[Copyable] => [Copyable] [permanent]

View File

@@ -77,7 +77,7 @@ _ = ##"""
/// passes again.
/// See https://github.com/apple/swift/issues/51192.
_ = #"""#
// CHECK: "\xE2\x80\x8B\"\xE2\x80\x8B"
// CHECK: "\""
_ = #""""#
// CHECK: "\"\""

View File

@@ -52,6 +52,6 @@ TEST(ASTDumper, ArchetypeType) {
}
EXPECT_EQ(str,
" name=\"\\xCF\\x84_0_0\"\n"
" name=\"τ_0_0\"\n"
" (interface_type=generic_type_param_type depth=0 index=0 param_kind=type))\n");
}