Please review fix for PR18919, that adds support for :vararg macro in integrated assembler.
I'd like to see more tests here. .macro statements with normal arguments preceding the :vararg one. Something like:
.macro foo bar, baz:vararg ... .endmacro
A test without a comma between bar and baz would be good as well.
This comment is a bit hard to read, perhaps something more like:
// We want the quotes around the string's contents when parsing for varargs.
Please use /*Varag=*/false to make it clear what is going on.
You should probably have a test with a darwin triple too. I cced Jim Grosbach for him to comment if this is a desirable feature for darwin or not. I know the macro system is a bit different, but I don't know the details.
I have implementation for darwin, though in draft state.
There are few reasons/questions:
- I didn't find anything about vararg in darwin assembler reference. Or even some .s examples.
- If I remember properly, you can substitude parameters by their number: $0, $1, etc. So, may he then, you can refer to some of vararg params as well? Am I right here?
- Can I use whole varargs set substitution? Like in Linux tests?
- If answer to #2 and #3 is "yes", then I suspect we have to keep vararg values in two forms: as parsed and separated values, and as single string. We need second form, because we need to remember separators as well, in another words we have to expand it as-is. At least we have to keep separators for second form.
Anyway I'm ready to work on it too. But darwin support could contain a bit more changes. Perhaps we could commit it separately?