This is an archive of the discontinued LLVM Phabricator instance.

[ms] [llvm-ml] Match ML's handling of macro parameter expansion
Needs ReviewPublic

Authored by epastor on Jul 21 2021, 8:57 AM.

Details

Summary

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.

Diff Detail

Event Timeline

epastor created this revision.Jul 21 2021, 8:57 AM
epastor requested review of this revision.Jul 21 2021, 8:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2021, 8:57 AM
epastor updated this revision to Diff 360881.Jul 22 2021, 10:45 AM

Rebase on parent