[PATCH] D59452: [mips] Fix crash on recursive using of .set
Simon Atanasyan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 19 08:16:28 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL356461: [mips] Fix crash on recursive using of .set (authored by atanasyan, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D59452?vs=190958&id=191307#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59452/new/
https://reviews.llvm.org/D59452
Files:
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/test/MC/Mips/set-sym-recursive.s
Index: llvm/trunk/test/MC/Mips/set-sym-recursive.s
===================================================================
--- llvm/trunk/test/MC/Mips/set-sym-recursive.s
+++ llvm/trunk/test/MC/Mips/set-sym-recursive.s
@@ -0,0 +1,5 @@
+# RUN: not llvm-mc -triple mips-unknown-linux %s 2>&1 | FileCheck %s
+
+.set A, A + 1
+# CHECK: :[[@LINE-1]]:9: error: Recursive use of 'A'
+.word A
Index: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -28,6 +28,7 @@
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
+#include "llvm/MC/MCParser/MCAsmParserUtils.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCSectionELF.h"
@@ -6803,7 +6804,6 @@
bool MipsAsmParser::parseSetAssignment() {
StringRef Name;
- const MCExpr *Value;
MCAsmParser &Parser = getParser();
if (Parser.parseIdentifier(Name))
@@ -6821,17 +6821,16 @@
RegisterSets[Name] = Parser.getTok();
Parser.Lex(); // Eat identifier.
getContext().getOrCreateSymbol(Name);
- } else if (!Parser.parseExpression(Value)) {
- // Parse assignment of an expression including
- // symbolic registers:
- // .set $tmp, $BB0-$BB1
- // .set r2, $f2
- MCSymbol *Sym = getContext().getOrCreateSymbol(Name);
- Sym->setVariableValue(Value);
- } else {
- return reportParseError("expected valid expression after comma");
+ return false;
}
+ MCSymbol *Sym;
+ const MCExpr *Value;
+ if (MCParserUtils::parseAssignmentExpression(Name, /* allow_redef */ true,
+ Parser, Sym, Value))
+ return true;
+ Sym->setVariableValue(Value);
+
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59452.191307.patch
Type: text/x-patch
Size: 1953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190319/b90251ff/attachment.bin>
More information about the llvm-commits
mailing list