[llvm] r333402 - [mips] Stop parsing a .set assignment if the first argument is not an identifier
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Tue May 29 02:51:23 PDT 2018
Author: atanasyan
Date: Tue May 29 02:51:22 2018
New Revision: 333402
URL: http://llvm.org/viewvc/llvm-project?rev=333402&view=rev
Log:
[mips] Stop parsing a .set assignment if the first argument is not an identifier
Before this fix the following code triggers two error messages. The
second one is at least useless:
test.s:1:9: error: expected identifier after .set
.set 123, $a0
^
test-set.s:1:9: error: unexpected token, expected comma
.set 123, $a0
^
Modified:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/test/MC/Mips/mips_directives_bad.s
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=333402&r1=333401&r2=333402&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Tue May 29 02:51:22 2018
@@ -6843,7 +6843,7 @@ bool MipsAsmParser::parseSetAssignment()
MCAsmParser &Parser = getParser();
if (Parser.parseIdentifier(Name))
- reportParseError("expected identifier after .set");
+ return reportParseError("expected identifier after .set");
if (getLexer().isNot(AsmToken::Comma))
return reportParseError("unexpected token, expected comma");
@@ -7330,8 +7330,7 @@ bool MipsAsmParser::parseDirectiveSet()
return parseSetNoGINVDirective();
} else {
// It is just an identifier, look for an assignment.
- parseSetAssignment();
- return false;
+ return parseSetAssignment();
}
return true;
Modified: llvm/trunk/test/MC/Mips/mips_directives_bad.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips_directives_bad.s?rev=333402&r1=333401&r2=333402&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips_directives_bad.s (original)
+++ llvm/trunk/test/MC/Mips/mips_directives_bad.s Tue May 29 02:51:22 2018
@@ -57,3 +57,13 @@
# CHECK-NEXT: :{{[0-9]+}}:{{[0-9]+}}: error: unexpected token, expected end of statement
# CHECK-NEXT: .option pic2 pic3
# CHECK-NEXT: ^
+
+ .set 123, $a0
+# CHECK-NEXT: :{{[0-9]+}}:{{[0-9]+}}: error: expected identifier after .set
+# CHECK-NEXT: .set 123
+# CHECK-NEXT: ^
+
+ .set reg.
+# CHECK-NEXT: :{{[0-9]+}}:{{[0-9]+}}: error: unexpected token, expected comma
+# CHECK-NEXT: .set reg.
+# CHECK-NEXT: ^
More information about the llvm-commits
mailing list