From: Nico Weber Date: Mon, 7 Oct 2019 11:46:26 +0000 (+0000) Subject: Revert r373888 "[IA] Recognize hexadecimal escape sequences" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbd280f4e1ced8cef113adb11ded8c60ebf52ec5;p=llvm Revert r373888 "[IA] Recognize hexadecimal escape sequences" It broke MC/AsmParser/directive_ascii.s on all bots: Assertion failed: (Index < Length && "Invalid index!"), function operator[], file ../../llvm/include/llvm/ADT/StringRef.h, line 243. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373898 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index b25959b102d..381bf964161 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -2914,26 +2914,11 @@ bool AsmParser::parseEscapedString(std::string &Data) { } // Recognize escaped characters. Note that this escape semantics currently - // loosely follows Darwin 'as'. + // loosely follows Darwin 'as'. Notably, it doesn't support hex escapes. ++i; if (i == e) return TokError("unexpected backslash at end of string"); - // Recognize hex sequences similarly to GNU 'as'. - if (Str[i] == 'x' || Str[i] == 'X') { - if (!isHexDigit(Str[i + 1])) - return TokError("invalid hexadecimal escape sequence"); - - // Consume hex characters. GNU 'as' reads all hexadecimal characters and - // then truncates to the lower 16 bits. Seems reasonable. - unsigned Value = 0; - while (isHexDigit(Str[i + 1])) - Value = Value * 16 + hexDigitValue(Str[++i]); - - Data += (unsigned char)(Value & 0xFF); - continue; - } - // Recognize octal sequences. if ((unsigned)(Str[i] - '0') <= 7) { // Consume up to three octal characters. diff --git a/test/MC/AsmParser/directive_ascii.s b/test/MC/AsmParser/directive_ascii.s index 604f9721bcc..a7ba7bbd5da 100644 --- a/test/MC/AsmParser/directive_ascii.s +++ b/test/MC/AsmParser/directive_ascii.s @@ -39,8 +39,3 @@ TEST5: # CHECK: .byte 0 TEST6: .string "B", "C" - -# CHECK: TEST7: -# CHECK: .ascii "dk" -TEST7: - .ascii "\x64\Xa6B"