This patch introduces additional infrastructure necessary to accommodate DiagnosticOptions.
DiagnosticOptions are unique in that they are parsed by the same function in cc1 AND in the Clang driver. The call to the parsing function from the driver occurs early on in the compilation process, where no proper DiagnosticEngine exists, because the diagnostic options (passed through command line) are not known yet.
To preserve the current behavior, we need to be able to selectively parse:
- all options (for -cc1),
- only diagnostic options (for driver).
This patch achieves that in the following way:
- new MacroPrefix field is added to the Option TableGen class,
- new IsDiag TableGen mixin sets MacroPrefix to "DIAG_",
- TableGen backend serializes option records into a macro with the prefix,
- CompilerInvocation parse/generate methods define the [DIAG_]OPTION_WITH_MARSHALLING macros to handle diagnostic options separately.