[PATCH] D60451: Do not allow ASCII literals to be parsed
Brandon Jones via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 02:50:57 PDT 2019
BrandonTJones created this revision.
BrandonTJones added reviewers: andreadb, grosbach.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
Repository:
rL LLVM
https://reviews.llvm.org/D60451
Files:
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/test/MC/AsmParser/floating-literals.s
Index: llvm/test/MC/AsmParser/floating-literals.s
===================================================================
--- llvm/test/MC/AsmParser/floating-literals.s
+++ llvm/test/MC/AsmParser/floating-literals.s
@@ -90,6 +90,8 @@
.double 1e1e
# CHECK-ERROR: Invalid sign in float literal
.double 2.+1
+#CHECK-ERROR: error: ASCII literal not supported in '.double' directive
+.double 't'
# CHECK: .long 1310177520
.float 0x12f7.1ep+17
Index: llvm/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/AsmParser.cpp
+++ llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3076,6 +3076,12 @@
// Convert to an APFloat.
APFloat Value(Semantics);
StringRef IDVal = getTok().getString();
+
+ // We do not currently handle ASCII literals e.g. 't' = 116
+ if(getLexer().is(AsmToken::Integer) && IDVal.startswith("'")){
+ return TokError("ASCII literal not supported");
+ }
+
if (getLexer().is(AsmToken::Identifier)) {
if (!IDVal.compare_lower("infinity") || !IDVal.compare_lower("inf"))
Value = APFloat::getInf(Semantics);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60451.194277.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190409/464e54ad/attachment.bin>
More information about the llvm-commits
mailing list