[ms] [llvm-ml] Disambiguate size directives and variable declarations
authorEric Astor <epastor@google.com>
Tue, 8 Jun 2021 19:30:11 +0000 (15:30 -0400)
committerEric Astor <epastor@google.com>
Tue, 8 Jun 2021 19:44:31 +0000 (15:44 -0400)
commitdc0c3fe5f35eb5fc8d5b36bb79761fb374a87269
treec9fb28cc89295b5df9e2aa0ab26b1ce9872e4fb6
parent27332968d85e1ad4a58df884030e55abc00e91b1
[ms] [llvm-ml] Disambiguate size directives and variable declarations

MASM allows statements of the form:
<VAR> DWORD 5
to declare a variable with name <VAR>, while:
call dword ptr [<value>]
is a valid instruction. To disambiguate, we recognize size directives by the trailing "ptr" token.

As discussed in https://lists.llvm.org/pipermail/llvm-dev/2021-May/150774.html

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D103257
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/test/tools/llvm-ml/reserved_words_conflict.asm [new file with mode: 0644]