in src/bindgen/library.rs [196:283]
fn transfer_annotations(&mut self) {
let mut annotations = HashMap::new();
self.typedefs.for_all_items_mut(|x| {
x.transfer_annotations(&mut annotations);
});
for (alias_path, annotations) in annotations {
// TODO
let mut transferred = false;
self.enums.for_items_mut(&alias_path, |x| {
if x.annotations().is_empty() {
*x.annotations_mut() = annotations.clone();
transferred = true;
} else {
warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
);
}
});
if transferred {
continue;
}
self.structs.for_items_mut(&alias_path, |x| {
if x.annotations().is_empty() {
*x.annotations_mut() = annotations.clone();
transferred = true;
} else {
warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
);
}
});
if transferred {
continue;
}
self.unions.for_items_mut(&alias_path, |x| {
if x.annotations().is_empty() {
*x.annotations_mut() = annotations.clone();
transferred = true;
} else {
warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
);
}
});
if transferred {
continue;
}
self.opaque_items.for_items_mut(&alias_path, |x| {
if x.annotations().is_empty() {
*x.annotations_mut() = annotations.clone();
transferred = true;
} else {
warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
);
}
});
if transferred {
continue;
}
self.typedefs.for_items_mut(&alias_path, |x| {
if x.annotations().is_empty() {
*x.annotations_mut() = annotations.clone();
transferred = true;
} else {
warn!(
"Can't transfer annotations from typedef to alias ({}) \
that already has annotations.",
alias_path
);
}
});
if transferred {
continue;
}
}
}