diff options
Diffstat (limited to 'libbindgen/src')
-rw-r--r-- | libbindgen/src/ir/context.rs | 6 | ||||
-rw-r--r-- | libbindgen/src/ir/var.rs | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs index e3dc3384..2d877920 100644 --- a/libbindgen/src/ir/context.rs +++ b/libbindgen/src/ir/context.rs @@ -2,6 +2,7 @@ use BindgenOptions; use cexpr; +use chooser::TypeChooser; use clang::{self, Cursor}; use parse::ClangItemParser; use std::borrow::Cow; @@ -184,6 +185,11 @@ impl<'ctx> BindgenContext<'ctx> { me } + /// Get the user-provided type chooser by reference, if any. + pub fn type_chooser(&self) -> Option<&TypeChooser> { + self.options().type_chooser.as_ref().map(|t| &**t) + } + /// Define a new item. /// /// This inserts it into the internal items set, and its type into the diff --git a/libbindgen/src/ir/var.rs b/libbindgen/src/ir/var.rs index e18af91b..329393fa 100644 --- a/libbindgen/src/ir/var.rs +++ b/libbindgen/src/ir/var.rs @@ -147,9 +147,7 @@ impl ClangSubItemParser for Var { (TypeKind::Pointer(char_ty), VarType::String(val)) } EvalResult::Int(Wrapping(value)) => { - let kind = ctx.options() - .type_chooser - .as_ref() + let kind = ctx.type_chooser() .and_then(|c| c.int_macro(&name, value)) .unwrap_or_else(|| { if value < 0 { |