[PATCH] D106454: [ms] [llvm-ml] Match ML's handling of macro parameter expansion

Eric Astor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 08:57:47 PDT 2021


epastor created this revision.
epastor added reviewers: mstorsjo, rnk, thakis.
Herald added a subscriber: hiraditya.
epastor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Matching ML.EXE, we expand tokens in macro parameters only if the parameter starts with a % character.

Also matching ML.EXE's behavior: If a macro parameter does start with a % character, unless the parameter consists of a single non-numeric macro, we also try to evaluate the resulting expanded parameter as an absolute expression if possible. If this succeeds, the parameter is replaced by its numeric value expressed in decimal. The exceptional case mentioned allows for parameters such as %@Date (where @Date renders in MM/DD/YY format) without accidental evaluation as a numeric expression.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106454

Files:
  llvm/lib/MC/MCParser/MasmParser.cpp
  llvm/test/tools/llvm-ml/macro.asm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106454.360487.patch
Type: text/x-patch
Size: 12484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210721/801d52e1/attachment.bin>


More information about the llvm-commits mailing list