From 3e2566d6a76a25da6ac25a99ca30f8c8b45350c8 Mon Sep 17 00:00:00 2001 From: Darren Kulp Date: Sun, 21 Jun 2020 17:30:32 -0700 Subject: Remove obsoleted `is_loaded` checks It is not clear what version of libclang these supported. Refer to #1321, #1304, #916, #915. --- src/clang.rs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/clang.rs b/src/clang.rs index 357a6dd5..28fce4c3 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -70,11 +70,7 @@ impl Cursor { /// Get the mangled name of this cursor's referent. pub fn mangling(&self) -> String { - if clang_Cursor_getMangling::is_loaded() { - unsafe { cxstring_into_string(clang_Cursor_getMangling(self.x)) } - } else { - self.spelling() - } + unsafe { cxstring_into_string(clang_Cursor_getMangling(self.x)) } } /// Gets the C++ manglings for this cursor, or an error if the manglings @@ -632,10 +628,6 @@ impl Cursor { /// Get the offset of the field represented by the Cursor. pub fn offset_of_field(&self) -> Result { - if !clang_Cursor_getOffsetOfField::is_loaded() { - return Err(LayoutError::from(-1)); - } - let offset = unsafe { clang_Cursor_getOffsetOfField(self.x) }; if offset < 0 { @@ -1102,13 +1094,6 @@ impl Type { /// Get the number of template arguments this type has, or `None` if it is /// not some kind of template. pub fn num_template_args(&self) -> Option { - // If an old libclang is loaded, we have no hope of answering this - // question correctly. However, that's no reason to panic when - // generating bindings for simple C headers with an old libclang. - if !clang_Type_getNumTemplateArguments::is_loaded() { - return None; - } - let n = unsafe { clang_Type_getNumTemplateArguments(self.x) }; if n >= 0 { Some(n as u32) @@ -1848,11 +1833,7 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult { format!(" {}spelling = \"{}\"", prefix, ty.spelling()), ); let num_template_args = - if clang_Type_getNumTemplateArguments::is_loaded() { - unsafe { clang_Type_getNumTemplateArguments(ty.x) } - } else { - -1 - }; + unsafe { clang_Type_getNumTemplateArguments(ty.x) }; if num_template_args >= 0 { print_indent( depth, -- cgit v1.2.3