diff options
-rwxr-xr-x | src/bin/bindgen.rs | 2 | ||||
-rwxr-xr-x | src/clang.rs | 8 | ||||
-rw-r--r-- | src/ir/ty.rs | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/bin/bindgen.rs b/src/bin/bindgen.rs index 55d3fdde..14e882bc 100755 --- a/src/bin/bindgen.rs +++ b/src/bin/bindgen.rs @@ -70,7 +70,7 @@ pub fn main() { } } - match builder_from_flags(env::args()) { + match builder_from_flags(bind_args.into_iter()) { Ok((builder, output)) => { let mut bindings = builder.generate() .expect("Unable to generate bindings"); diff --git a/src/clang.rs b/src/clang.rs index 47b7b31e..385fd09a 100755 --- a/src/clang.rs +++ b/src/clang.rs @@ -264,11 +264,13 @@ impl Cursor { /// Given that this cursor's referent is reference type, get the cursor /// pointing to the referenced type. - pub fn referenced(&self) -> Cursor { + pub fn referenced(&self) -> Option<Cursor> { unsafe { - Cursor { + let ret = Cursor { x: clang_getCursorReferenced(self.x), - } + }; + + if ret.is_valid() { Some(ret) } else { None } } } diff --git a/src/ir/ty.rs b/src/ir/ty.rs index d5ac6116..59044bdd 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -667,7 +667,7 @@ impl Type { TypeKind::TemplateAlias(inner.unwrap(), args) } CXCursor_TemplateRef => { - let referenced = location.referenced(); + let referenced = location.referenced().expect("expected value, got none"); let referenced_ty = referenced.cur_type(); let referenced_declaration = Some(referenced_ty.declaration()); @@ -679,7 +679,7 @@ impl Type { ctx); } CXCursor_TypeRef => { - let referenced = location.referenced(); + let referenced = location.referenced().expect("expected value, got none"); let referenced_ty = referenced.cur_type(); let referenced_declaration = Some(referenced_ty.declaration()); |