Skip to content

Commit 8c0c59e

Browse files
committed
[SVD Import] Remove "add bitfield" setting
We unconditionally add them now that bitfields are represented correctly in the type system
1 parent a8136a2 commit 8c0c59e

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

plugins/svd/src/lib.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,6 @@ impl AddCommentsField {
5151
}
5252
}
5353

54-
pub struct AddBitfieldsField;
55-
56-
impl AddBitfieldsField {
57-
pub fn field(default: bool) -> FormInputField {
58-
FormInputField::Checkbox {
59-
prompt: "Add Bitfields".to_string(),
60-
default: Some(default),
61-
value: false,
62-
}
63-
}
64-
65-
pub fn from_form(form: &Form) -> Option<bool> {
66-
let field = form.get_field_with_name("Add Bitfields")?;
67-
let field_value = field.try_value_int()?;
68-
match field_value {
69-
1 => Some(true),
70-
_ => Some(false),
71-
}
72-
}
73-
}
74-
7554
pub struct AddMemoryRegionsField;
7655

7756
impl AddMemoryRegionsField {
@@ -101,7 +80,6 @@ impl Command for LoadSVDFile {
10180
let mut load_settings = LoadSettings::from_view_settings(view);
10281
form.add_field(LoadFileField::field());
10382
form.add_field(AddCommentsField::field(load_settings.add_comments));
104-
form.add_field(AddBitfieldsField::field(load_settings.add_bitfields));
10583
form.add_field(AddMemoryRegionsField::field(
10684
load_settings.add_backing_regions,
10785
));
@@ -112,7 +90,6 @@ impl Command for LoadSVDFile {
11290
return;
11391
};
11492
load_settings.add_comments = AddCommentsField::from_form(&form).unwrap_or(true);
115-
load_settings.add_bitfields = AddBitfieldsField::from_form(&form).unwrap_or(true);
11693
load_settings.add_backing_regions = AddMemoryRegionsField::from_form(&form).unwrap_or(true);
11794

11895
let file_content = match std::fs::read_to_string(&file_path) {

plugins/svd/src/settings.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ use std::path::PathBuf;
66
#[derive(Debug, Clone)]
77
pub struct LoadSettings {
88
pub add_backing_regions: bool,
9-
pub add_bitfields: bool,
109
pub add_comments: bool,
1110
pub auto_load_file: Option<PathBuf>,
1211
}
1312

1413
impl LoadSettings {
1514
pub const ADD_BACKING_REGIONS_DEFAULT: bool = true;
1615
pub const ADD_BACKING_REGIONS_SETTING: &'static str = "analysis.svd.addBackingRegions";
17-
pub const ADD_BITFIELDS_DEFAULT: bool = true;
18-
pub const ADD_BITFIELDS_SETTING: &'static str = "analysis.svd.addBitfields";
1916
pub const ADD_COMMENTS_DEFAULT: bool = true;
2017
pub const ADD_COMMENTS_SETTING: &'static str = "analysis.svd.addComments";
2118
pub const AUTO_LOAD_FILE_DEFAULT: &'static str = "";
@@ -35,17 +32,6 @@ impl LoadSettings {
3532
&add_backing_region_props.to_string(),
3633
);
3734

38-
let add_bitfields_props = json!({
39-
"title" : "Add Bitfields",
40-
"type" : "boolean",
41-
"default" : Self::ADD_BITFIELDS_DEFAULT,
42-
"description" : "Whether to add bitfields. Bitfields are not supported by Binary Ninja, so this is a workaround using unions.",
43-
});
44-
bn_settings.register_setting_json(
45-
Self::ADD_BITFIELDS_SETTING,
46-
&add_bitfields_props.to_string(),
47-
);
48-
4935
let add_comments_props = json!({
5036
"title" : "Add Comments",
5137
"type" : "boolean",
@@ -73,10 +59,6 @@ impl LoadSettings {
7359
load_settings.add_backing_regions =
7460
settings.get_bool_with_opts(Self::ADD_BACKING_REGIONS_SETTING, &mut query_opts);
7561
}
76-
if settings.contains(Self::ADD_BITFIELDS_SETTING) {
77-
load_settings.add_bitfields =
78-
settings.get_bool_with_opts(Self::ADD_BITFIELDS_SETTING, &mut query_opts);
79-
}
8062
if settings.contains(Self::ADD_COMMENTS_SETTING) {
8163
load_settings.add_comments =
8264
settings.get_bool_with_opts(Self::ADD_COMMENTS_SETTING, &mut query_opts);
@@ -97,7 +79,6 @@ impl Default for LoadSettings {
9779
fn default() -> Self {
9880
Self {
9981
add_backing_regions: Self::ADD_BACKING_REGIONS_DEFAULT,
100-
add_bitfields: Self::ADD_BITFIELDS_DEFAULT,
10182
add_comments: Self::ADD_COMMENTS_DEFAULT,
10283
auto_load_file: None,
10384
}

0 commit comments

Comments
 (0)