diff options
author | Roman Divacky <rdivacky@freebsd.org> | 2013-09-24 17:44:41 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@freebsd.org> | 2013-09-24 17:44:41 +0000 |
commit | 9c60710c8045f6f22151da1271e2d40d1f68bcfd (patch) | |
tree | b43b6238af8e025b25296f3b8a81781edd03020f /lib/MC | |
parent | d44f9f2ff88cd03e3f944ecdd6373737d5acdb90 (diff) | |
download | external_llvm-9c60710c8045f6f22151da1271e2d40d1f68bcfd.zip external_llvm-9c60710c8045f6f22151da1271e2d40d1f68bcfd.tar.gz external_llvm-9c60710c8045f6f22151da1271e2d40d1f68bcfd.tar.bz2 |
Make the size and expr arguments of .fill directive optional.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index c1f825a..1267dc8 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -2353,7 +2353,7 @@ bool AsmParser::parseDirectiveZero() { } /// parseDirectiveFill -/// ::= .fill expression , expression , expression +/// ::= .fill expression [ , expression [ , expression ] ] bool AsmParser::parseDirectiveFill() { checkForValidSection(); @@ -2361,26 +2361,31 @@ bool AsmParser::parseDirectiveFill() { if (parseAbsoluteExpression(NumValues)) return true; - if (getLexer().isNot(AsmToken::Comma)) - return TokError("unexpected token in '.fill' directive"); - Lex(); + int64_t FillSize = 1; + int64_t FillExpr = 0; - int64_t FillSize; - if (parseAbsoluteExpression(FillSize)) - return true; + if (getLexer().isNot(AsmToken::EndOfStatement)) { + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in '.fill' directive"); + Lex(); - if (getLexer().isNot(AsmToken::Comma)) - return TokError("unexpected token in '.fill' directive"); - Lex(); + if (parseAbsoluteExpression(FillSize)) + return true; - int64_t FillExpr; - if (parseAbsoluteExpression(FillExpr)) - return true; + if (getLexer().isNot(AsmToken::EndOfStatement)) { + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in '.fill' directive"); + Lex(); - if (getLexer().isNot(AsmToken::EndOfStatement)) - return TokError("unexpected token in '.fill' directive"); + if (parseAbsoluteExpression(FillExpr)) + return true; - Lex(); + if (getLexer().isNot(AsmToken::EndOfStatement)) + return TokError("unexpected token in '.fill' directive"); + + Lex(); + } + } if (FillSize != 1 && FillSize != 2 && FillSize != 4 && FillSize != 8) return TokError("invalid '.fill' size, expected 1, 2, 4, or 8"); |