This is an archive of the discontinued LLVM Phabricator instance.

[ms] [llvm-ml] Implement the statement expansion operator
ClosedPublic

Authored by epastor on Oct 19 2020, 2:15 PM.

Details

Summary

If prefaced with a %, expand text macros and macro functions in any statement.

Also, prevent expanding text macros in the message of an ECHO directive unless expanded explicitly by the statement expansion operator.

Diff Detail

Event Timeline

epastor created this revision.Oct 19 2020, 2:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2020, 2:15 PM
epastor requested review of this revision.Oct 19 2020, 2:15 PM
epastor updated this revision to Diff 303170.Nov 5 2020, 10:33 AM

Rebase on HEAD

epastor updated this revision to Diff 307160.Nov 23 2020, 12:09 PM

Rebase on parent

Looks like there's no coverage for expanding statements that aren't the echo special case - - could you add coverage for that too? Other than that, lg!

llvm/include/llvm/MC/MCAsmMacro.h
147

IsFunction

llvm/lib/MC/MCParser/MasmParser.cpp
5565

IsMacroFunction

epastor updated this revision to Diff 307683.Nov 25 2020, 12:29 PM

Add a test case covering the lack of impact on typical statements

epastor updated this revision to Diff 307686.Nov 25 2020, 12:34 PM

Rebase on parent

epastor marked 2 inline comments as done.Nov 25 2020, 12:36 PM

Looks like there's no coverage for expanding statements that aren't the echo special case - - could you add coverage for that too? Other than that, lg!

Oddly enough, MASM documentation suggests no use for this form except for ECHO and similar special cases, as strings are generally meant to be lexed.

thakis accepted this revision.Nov 25 2020, 5:23 PM
This revision is now accepted and ready to land.Nov 25 2020, 5:23 PM
thakis added inline comments.Nov 25 2020, 5:25 PM
llvm/test/tools/llvm-ml/macro_function.test
106 ↗(On Diff #307686)

(this looks the same as the test in https://reviews.llvm.org/D89741 ; i'm guessing it belongs over there and not to this patch here.)

epastor updated this revision to Diff 308383.Nov 30 2020, 8:38 AM

Remove unrelated test update.

epastor updated this revision to Diff 308384.Nov 30 2020, 8:38 AM

Rebase to HEAD

Harbormaster completed remote builds in B80534: Diff 308383.
epastor updated this revision to Diff 308421.Nov 30 2020, 10:32 AM

Fix typo in test

This revision was landed with ongoing or failed builds.Nov 30 2020, 11:33 AM
This revision was automatically updated to reflect the committed changes.