summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/callbacks.rs5
-rw-r--r--src/ir/item.rs5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs
index 71b98fc9..26f77338 100644
--- a/src/callbacks.rs
+++ b/src/callbacks.rs
@@ -55,4 +55,9 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe {
) -> Option<String> {
None
}
+
+ /// Allows to rename an item, replacing `_original_item_name`.
+ fn item_name(&self, _original_item_name: &str) -> Option<String> {
+ None
+ }
}
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 5f0ccc0b..a6ee4ff3 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -875,6 +875,11 @@ impl Item {
let name = names.join("_");
+ let name = ctx
+ .parse_callbacks()
+ .and_then(|callbacks| callbacks.item_name(&name))
+ .unwrap_or(name);
+
ctx.rust_mangle(&name).into_owned()
}