[PATCH] D94887: MC: fix AsmLexer not understanding some escapes (notably '\r' and '\f')
Ferdinand Bachmann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 17 11:59:53 PST 2021
Ferdi265 created this revision.
Herald added a subscriber: hiraditya.
Ferdi265 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch fixes Bug 48781.
llvm-mc, or also the integrated assembler in clang (which uses the same parser), doesn't understand the escapes '\r' and '\f'. This patch fixes that.
Reproducer: `llvm-mc <(echo ".byte '\\r'")`
Expected: `.text .byte 13`
Actual: `.text .byte 114`
After Bug 8615, support was added for basic character escapes, but '\r' and '\f' were seemingly forgotten.
By adding those two escapes to llvm-mc, LLVM would achieve feature parity with GNU as for character constants as described by the `info as` manual.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94887
Files:
llvm/lib/MC/MCParser/AsmLexer.cpp
Index: llvm/lib/MC/MCParser/AsmLexer.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmLexer.cpp
+++ llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -569,6 +569,8 @@
case 't': Value = '\t'; break;
case 'n': Value = '\n'; break;
case 'b': Value = '\b'; break;
+ case 'r': Value = '\r'; break;
+ case 'f': Value = '\f'; break;
}
} else
Value = TokStart[1];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94887.317243.patch
Type: text/x-patch
Size: 438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210117/2b81f6e6/attachment.bin>
More information about the llvm-commits
mailing list