summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Support/StringExtras.cpp4
-rw-r--r--llvm/test/Assembler/asm-path-writer.ll4
-rw-r--r--llvm/test/Assembler/source-filename-backslash.ll5
-rw-r--r--llvm/test/CodeGen/MIR/X86/global-value-operands.mir2
-rw-r--r--llvm/unittests/ADT/StringExtrasTest.cpp2
-rw-r--r--llvm/unittests/IR/MetadataTest.cpp2
6 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp
index bf28b2be565..af8dd463e12 100644
--- a/llvm/lib/Support/StringExtras.cpp
+++ b/llvm/lib/Support/StringExtras.cpp
@@ -60,7 +60,9 @@ void llvm::SplitString(StringRef Source,
void llvm::printEscapedString(StringRef Name, raw_ostream &Out) {
for (unsigned i = 0, e = Name.size(); i != e; ++i) {
unsigned char C = Name[i];
- if (isPrint(C) && C != '\\' && C != '"')
+ if (C == '\\')
+ Out << '\\' << C;
+ else if (isPrint(C) && C != '"')
Out << C;
else
Out << '\\' << hexdigit(C >> 4) << hexdigit(C & 0x0F);
diff --git a/llvm/test/Assembler/asm-path-writer.ll b/llvm/test/Assembler/asm-path-writer.ll
index f2263956672..a0e63ef2040 100644
--- a/llvm/test/Assembler/asm-path-writer.ll
+++ b/llvm/test/Assembler/asm-path-writer.ll
@@ -1,6 +1,6 @@
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-; CHECK: ^0 = module: (path: ".\5Cf4folder\5Cabc.o", hash: (0, 0, 0, 0, 0))
+; CHECK: ^0 = module: (path: ".\\f4folder\\abc.o", hash: (0, 0, 0, 0, 0))
-^0 = module: (path: ".\5Cf4folder\5Cabc.o", hash: (0, 0, 0, 0, 0))
+^0 = module: (path: ".\5Cf4folder\\abc.o", hash: (0, 0, 0, 0, 0))
^1 = gv: (guid: 15822663052811949562, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2)))
diff --git a/llvm/test/Assembler/source-filename-backslash.ll b/llvm/test/Assembler/source-filename-backslash.ll
index 8669401cf93..c4b25c6053d 100644
--- a/llvm/test/Assembler/source-filename-backslash.ll
+++ b/llvm/test/Assembler/source-filename-backslash.ll
@@ -1,8 +1,7 @@
-
; Make sure that llvm-as/llvm-dis properly assemble/disassemble the
; source_filename.
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
-; CHECK: source_filename = "C:\5Cpath\5Cwith\5Cbackslashes\5Ctest.cc"
-source_filename = "C:\5Cpath\5Cwith\5Cbackslashes\5Ctest.cc"
+; CHECK: source_filename = "C:\\path\\with\\backslashes\\test.cc"
+source_filename = "C:\\path\\with\5Cbackslashes\\test.cc"
diff --git a/llvm/test/CodeGen/MIR/X86/global-value-operands.mir b/llvm/test/CodeGen/MIR/X86/global-value-operands.mir
index 6287f99e398..7b55cb4f14e 100644
--- a/llvm/test/CodeGen/MIR/X86/global-value-operands.mir
+++ b/llvm/test/CodeGen/MIR/X86/global-value-operands.mir
@@ -103,7 +103,7 @@ body: |
name: test2
body: |
bb.0.entry:
- ; CHECK: , @"\01Hello@$%09 \5C World,",
+ ; CHECK: , @"\01Hello@$%09 \\ World,",
$rax = MOV64rm $rip, 1, _, @"\01Hello@$%09 \\ World,", _
$eax = MOV32rm killed $rax, 1, _, 0, _
RETQ $eax
diff --git a/llvm/unittests/ADT/StringExtrasTest.cpp b/llvm/unittests/ADT/StringExtrasTest.cpp
index 97c91de1d3f..921fc7d349a 100644
--- a/llvm/unittests/ADT/StringExtrasTest.cpp
+++ b/llvm/unittests/ADT/StringExtrasTest.cpp
@@ -109,7 +109,7 @@ TEST(StringExtrasTest, printEscapedString) {
std::string str;
raw_string_ostream OS(str);
printEscapedString("ABCdef123&<>\\\"'\t", OS);
- EXPECT_EQ("ABCdef123&<>\\5C\\22'\\09", OS.str());
+ EXPECT_EQ("ABCdef123&<>\\\\\\22'\\09", OS.str());
}
TEST(StringExtrasTest, printHTMLEscaped) {
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index fa0dc61d3df..e6c7a501139 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -164,7 +164,7 @@ TEST_F(MDStringTest, PrintingComplex) {
std::string Str;
raw_string_ostream oss(Str);
s->print(oss);
- EXPECT_STREQ("!\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
+ EXPECT_STREQ("!\"\\00\\0A\\22\\\\\\FF\"", oss.str().c_str());
}
typedef MetadataTest MDNodeTest;
OpenPOWER on IntegriCloud