This is an archive of the discontinued LLVM Phabricator instance.

[clang][cli] Use variadic macros for parsing/generating
ClosedPublic

Authored by jansvoboda11 on Jan 27 2021, 7:55 AM.

Details

Summary

This patch makes all macros forwarding to PARSE_OPTION_WITH_MARSHALLING and GENERATE_OPTION_WITH_MARSHALLING variadic.

Sice we will be splitting up all CompilerInvocation parts, this will allow us to avoid a lot of boilerplate code.

The local macros prefix forwarded arguments with local variables required by the main macros. The {THIS,NO}_PREFIX macros make it possible for forwarding macros in member functions (parseSimpleArgs, generateCC1CommandLine) to prefix keypaths with this->. (Some build bots seem to require that.)

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Jan 27 2021, 7:55 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 27 2021, 7:55 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Jan 27 2021, 12:46 PM
This revision was landed with ongoing or failed builds.Jan 28 2021, 1:35 AM
This revision was automatically updated to reflect the committed changes.

Reverted this, because we're hitting weird preprocessor behavior in MSVC 2017. __VA_ARGS__ form a single preprocessing token that cannot be expanded into the original arguments, in our case PREFIX_TYPE, NAME, ID, etc.