[PATCH] D18747: [Support] Fix an invalid character escaping in string literal (unittest).

Etienne Bergeron via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 3 11:40:08 PDT 2016


etienneb created this revision.
etienneb added reviewers: rnk, alexfh.
etienneb added a subscriber: cfe-commits.

A character within a string literal is not escaped correctly.
In this case, there is no semantic change because the invalid character turn out to be NUL anyway.

note: "\0x12" is equivalent to {0, 'x', '1', '2'} and not { 12 }.

This issue was found by clang-tidy.

http://reviews.llvm.org/D18747

Files:
  unittests/Support/Path.cpp

Index: unittests/Support/Path.cpp
===================================================================
--- unittests/Support/Path.cpp
+++ unittests/Support/Path.cpp
@@ -725,7 +725,7 @@
 const char coff_import_library[] = "\x00\x00\xff\xff....";
 const char elf_relocatable[] = { 0x7f, 'E', 'L', 'F', 1, 2, 1, 0, 0,
                                  0,    0,   0,   0,   0, 0, 0, 0, 1 };
-const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\0x00";
+const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\x00";
 const char macho_object[] =
     "\xfe\xed\xfa\xce........\x00\x00\x00\x01............";
 const char macho_executable[] =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18747.52509.patch
Type: text/x-patch
Size: 642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160403/4d7366e3/attachment.bin>


More information about the cfe-commits mailing list