OSDN Git Service

[RISCV] Fix failure to parse parenthesized immediates
authorLewis Revill <lewis.revill@embecosm.com>
Wed, 19 Jun 2019 10:11:13 +0000 (10:11 +0000)
committerLewis Revill <lewis.revill@embecosm.com>
Wed, 19 Jun 2019 10:11:13 +0000 (10:11 +0000)
commit74188ea645ff546e35873235cb67e4dd32dbe017
treeb450fa71a4a64be4ec0321d3afe72e3ab7fb94a4
parent96b71308194a7c3a485ffba531642c050ee85b82
[RISCV] Fix failure to parse parenthesized immediates

Since the parser attempts to parse an operand as a register with
parentheses before parsing it as an immediate, immediates in
parentheses should not be parsed by parseRegister. However in the case
where the immediate does not start with an identifier, the LParen is not
unlexed and so the RParen causes an unexpected token error.

This patch adds the missing UnLex, and modifies the existing UnLex to
not use a buffered token, as it should always be unlexing an LParen.

Differential Revision: https://reviews.llvm.org/D57319

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363782 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
test/MC/RISCV/rv32i-valid.s