diff options
author | Darren Kulp <darren@kulp.ch> | 2020-06-21 17:30:32 -0700 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-07-20 18:55:10 +0200 |
commit | 3e2566d6a76a25da6ac25a99ca30f8c8b45350c8 (patch) | |
tree | 09556a1900ca099418b60651a3e69b1917bf4478 /src | |
parent | 03dbd1a3f8d80be52d6105e76e7603d9a3b939e0 (diff) |
Remove obsoleted `is_loaded` checks
It is not clear what version of libclang these supported.
Refer to #1321, #1304, #916, #915.
Diffstat (limited to 'src')
-rw-r--r-- | src/clang.rs | 23 |
1 files 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<usize, LayoutError> { - 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<u32> { - // 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, |