Skip to content

Commit 077497d

Browse files
committed
[MCParser] Remove parseParenExprOfDepth
Introduced by http://reviews.llvm.org/D9742 as a hack, which then became unneeded. Primary test: llvm/test/MC/Mips/memory-offsets.s
1 parent 8ec0d60 commit 077497d

File tree

4 files changed

+1
-56
lines changed

4 files changed

+1
-56
lines changed

llvm/include/llvm/MC/MCParser/MCAsmParser.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,6 @@ class MCAsmParser {
331331
/// \return - False on success.
332332
virtual bool checkForValidSection() = 0;
333333

334-
/// Parse an arbitrary expression of a specified parenthesis depth,
335-
/// assuming that the initial '(' characters have already been consumed.
336-
///
337-
/// \param ParenDepth - Specifies how many trailing expressions outside the
338-
/// current parentheses we have to parse.
339-
/// \param Res - The value of the expression. The result is undefined
340-
/// on error.
341-
/// \return - False on success.
342-
virtual bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
343-
SMLoc &EndLoc) = 0;
344-
345334
/// Parse a .gnu_attribute.
346335
bool parseGNUAttribute(SMLoc L, int64_t &Tag, int64_t &IntegerValue);
347336
};

llvm/lib/MC/MCParser/AsmParser.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ class AsmParser : public MCAsmParser {
272272
bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
273273
AsmTypeInfo *TypeInfo) override;
274274
bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) override;
275-
bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
276-
SMLoc &EndLoc) override;
277275
bool parseAbsoluteExpression(int64_t &Res) override;
278276

279277
/// Parse a floating point expression using the float \p Semantics
@@ -1536,26 +1534,6 @@ bool AsmParser::parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) {
15361534
return parseParenExpr(Res, EndLoc) || parseBinOpRHS(1, Res, EndLoc);
15371535
}
15381536

1539-
bool AsmParser::parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
1540-
SMLoc &EndLoc) {
1541-
if (parseParenExpr(Res, EndLoc))
1542-
return true;
1543-
1544-
for (; ParenDepth > 0; --ParenDepth) {
1545-
if (parseBinOpRHS(1, Res, EndLoc))
1546-
return true;
1547-
1548-
// We don't Lex() the last RParen.
1549-
// This is the same behavior as parseParenExpression().
1550-
if (ParenDepth - 1 > 0) {
1551-
EndLoc = getTok().getEndLoc();
1552-
if (parseRParen())
1553-
return true;
1554-
}
1555-
}
1556-
return false;
1557-
}
1558-
15591537
bool AsmParser::parseAbsoluteExpression(int64_t &Res) {
15601538
const MCExpr *Expr;
15611539

llvm/lib/MC/MCParser/MasmParser.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,6 @@ class MasmParser : public MCAsmParser {
547547
bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc,
548548
AsmTypeInfo *TypeInfo) override;
549549
bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) override;
550-
bool parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
551-
SMLoc &EndLoc) override;
552550
bool parseAbsoluteExpression(int64_t &Res) override;
553551

554552
/// Parse a floating point expression using the float \p Semantics
@@ -1905,26 +1903,6 @@ bool MasmParser::parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) {
19051903
return parseParenExpr(Res, EndLoc) || parseBinOpRHS(1, Res, EndLoc);
19061904
}
19071905

1908-
bool MasmParser::parseParenExprOfDepth(unsigned ParenDepth, const MCExpr *&Res,
1909-
SMLoc &EndLoc) {
1910-
if (parseParenExpr(Res, EndLoc))
1911-
return true;
1912-
1913-
for (; ParenDepth > 0; --ParenDepth) {
1914-
if (parseBinOpRHS(1, Res, EndLoc))
1915-
return true;
1916-
1917-
// We don't Lex() the last RParen.
1918-
// This is the same behavior as parseParenExpression().
1919-
if (ParenDepth - 1 > 0) {
1920-
EndLoc = getTok().getEndLoc();
1921-
if (parseRParen())
1922-
return true;
1923-
}
1924-
}
1925-
return false;
1926-
}
1927-
19281906
bool MasmParser::parseAbsoluteExpression(int64_t &Res) {
19291907
const MCExpr *Expr;
19301908

llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6516,7 +6516,7 @@ bool MipsAsmParser::parseMemOffset(const MCExpr *&Res, bool isParenExpr) {
65166516
SMLoc S;
65176517

65186518
if (isParenExpr)
6519-
return getParser().parseParenExprOfDepth(0, Res, S);
6519+
return getParser().parseExpression(Res, S) || getParser().parseRParen();
65206520
return getParser().parseExpression(Res);
65216521
}
65226522

0 commit comments

Comments
 (0)