List preset's settings in generated comment (#4679)
Figuring out which boolean settings go into each preset is not easy by inspecting the DSL source (e.g. meta/src/isa/x86.rs). This patch extends the comments in the Rust that's generated by that DSL to list the names of the settings together with the name of the preset.
This commit is contained in:
@@ -110,6 +110,15 @@ impl Preset {
|
|||||||
}
|
}
|
||||||
layout
|
layout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn setting_names<'a>(
|
||||||
|
&'a self,
|
||||||
|
group: &'a SettingGroup,
|
||||||
|
) -> impl Iterator<Item = &'static str> + 'a {
|
||||||
|
self.values
|
||||||
|
.iter()
|
||||||
|
.map(|bool_index| group.settings[bool_index.0].name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct SettingGroup {
|
pub(crate) struct SettingGroup {
|
||||||
|
|||||||
@@ -370,7 +370,11 @@ fn gen_descriptors(group: &SettingGroup, fmt: &mut Formatter) {
|
|||||||
);
|
);
|
||||||
fmt.indent(|fmt| {
|
fmt.indent(|fmt| {
|
||||||
for preset in &group.presets {
|
for preset in &group.presets {
|
||||||
fmt.comment(preset.name);
|
fmt.comment(format!(
|
||||||
|
"{}: {}",
|
||||||
|
preset.name,
|
||||||
|
preset.setting_names(&group).collect::<Vec<_>>().join(", ")
|
||||||
|
));
|
||||||
for (mask, value) in preset.layout(&group) {
|
for (mask, value) in preset.layout(&group) {
|
||||||
fmtln!(fmt, "(0b{:08b}, 0b{:08b}),", mask, value);
|
fmtln!(fmt, "(0b{:08b}, 0b{:08b}),", mask, value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user