Skip to content

Commit 5b259ff

Browse files
committed
add merge_cfg_attributes pass and improve overall attribute capabilities
1 parent 0d066fb commit 5b259ff

File tree

6 files changed

+302
-226
lines changed

6 files changed

+302
-226
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ clang-sys = "1"
3131
clap = "4"
3232
clap_complete = "4"
3333
env_logger = "0.10.0"
34-
itertools = { version = ">=0.10,<0.14", default-features = false }
34+
itertools = { version = ">=0.10,<0.14", default-features = false, features = ["use_alloc"]}
3535
libloading = "0.8"
3636
log = "0.4"
3737
objc = "0.2"

bindgen/callbacks.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub use crate::ir::derive::CanDerive as ImplementsTrait;
55
pub use crate::ir::enum_ty::{EnumVariantCustomBehavior, EnumVariantValue};
66
pub use crate::ir::function::FunctionKind;
77
pub use crate::ir::int::IntKind;
8+
use crate::HashSet;
89
use std::fmt;
910

1011
/// An enum to allow ignoring parsing of macros.
@@ -134,9 +135,7 @@ pub trait ParseCallbacks: fmt::Debug {
134135
///
135136
/// If no additional attributes are wanted, this function should return an
136137
/// empty `Vec`.
137-
fn add_attributes(&self, _info: &AttributeInfo<'_>) -> Vec<String> {
138-
vec![]
139-
}
138+
fn process_attributes(&self, _info: &AttributeInfo<'_>, _attributes: &mut HashSet<String>) {}
140139

141140
/// Process a source code comment.
142141
fn process_comment(&self, _comment: &str) -> Option<String> {
@@ -252,6 +251,8 @@ pub enum AttributeItemKind {
252251
Enum,
253252
/// The item is a Rust `union`.
254253
Union,
254+
/// The item is a Rust variable.
255+
Var,
255256
/// The item is a Rust `fn`.
256257
Function(FunctionKind),
257258
}

0 commit comments

Comments
 (0)