Macro rustc_session::options::options

source ·
macro_rules! options {
    ($struct_name:ident, $stat:ident, $optmod:ident, $prefix:expr, $outputname:expr,
     $($( #[$attr:meta] )* $opt:ident : $t:ty = (
        $init:expr,
        $parse:ident,
        [$dep_tracking_marker:ident],
        $desc:expr)
     ),* ,) => { ... };
}
Expand description

Defines all CodegenOptions/DebuggingOptions fields and parsers all at once. The goal of this macro is to define an interface that can be programmatically used by the option parser to initialize the struct without hardcoding field names all over the place.

The goal is to invoke this macro once with the correct fields, and then this macro generates all necessary code. The main gotcha of this macro is the cgsetters module which is a bunch of generated code to parse an option into its respective field in the struct. There are a few hand-written parsers for parsing specific types of values in this module.