diff options
-rw-r--r-- | src/callbacks.rs | 5 | ||||
-rw-r--r-- | src/ir/var.rs | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/callbacks.rs b/src/callbacks.rs index 26f77338..81fe0c0e 100644 --- a/src/callbacks.rs +++ b/src/callbacks.rs @@ -35,6 +35,11 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe { None } + /// This will be run on every string macro. The callback can not influence the further + /// treatment of the macro, but may use the value to generate additional code or configuration. + fn str_macro(&self, _name: &str, _value: &[u8]) { + } + /// This function should return whether, given an enum variant /// name, and value, this enum variant will forcibly be a constant. fn enum_variant_behavior( diff --git a/src/ir/var.rs b/src/ir/var.rs index e29985ef..14f133fd 100644 --- a/src/ir/var.rs +++ b/src/ir/var.rs @@ -199,6 +199,9 @@ impl ClangSubItemParser for Var { true, ctx, ); + if let Some(callbacks) = ctx.parse_callbacks() { + callbacks.str_macro(&name, &val); + } (TypeKind::Pointer(char_ty), VarType::String(val)) } EvalResult::Int(Wrapping(value)) => { |