Skip to content

Commit 64333c0

Browse files
committed
Remove obsoleted is_loaded checks
It is not clear what version of libclang these supported. Refer to rust-lang#1321, rust-lang#1304, rust-lang#916, rust-lang#915.
1 parent f0909bc commit 64333c0

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/clang.rs

+2-21
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ impl Cursor {
7070

7171
/// Get the mangled name of this cursor's referent.
7272
pub fn mangling(&self) -> String {
73-
if clang_Cursor_getMangling::is_loaded() {
74-
unsafe { cxstring_into_string(clang_Cursor_getMangling(self.x)) }
75-
} else {
76-
self.spelling()
77-
}
73+
unsafe { cxstring_into_string(clang_Cursor_getMangling(self.x)) }
7874
}
7975

8076
/// Gets the C++ manglings for this cursor, or an error if the manglings
@@ -638,10 +634,6 @@ impl Cursor {
638634

639635
/// Get the offset of the field represented by the Cursor.
640636
pub fn offset_of_field(&self) -> Result<usize, LayoutError> {
641-
if !clang_Cursor_getOffsetOfField::is_loaded() {
642-
return Err(LayoutError::from(-1));
643-
}
644-
645637
let offset = unsafe { clang_Cursor_getOffsetOfField(self.x) };
646638

647639
if offset < 0 {
@@ -1108,13 +1100,6 @@ impl Type {
11081100
/// Get the number of template arguments this type has, or `None` if it is
11091101
/// not some kind of template.
11101102
pub fn num_template_args(&self) -> Option<u32> {
1111-
// If an old libclang is loaded, we have no hope of answering this
1112-
// question correctly. However, that's no reason to panic when
1113-
// generating bindings for simple C headers with an old libclang.
1114-
if !clang_Type_getNumTemplateArguments::is_loaded() {
1115-
return None;
1116-
}
1117-
11181103
let n = unsafe { clang_Type_getNumTemplateArguments(self.x) };
11191104
if n >= 0 {
11201105
Some(n as u32)
@@ -1854,11 +1839,7 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
18541839
format!(" {}spelling = \"{}\"", prefix, ty.spelling()),
18551840
);
18561841
let num_template_args =
1857-
if clang_Type_getNumTemplateArguments::is_loaded() {
1858-
unsafe { clang_Type_getNumTemplateArguments(ty.x) }
1859-
} else {
1860-
-1
1861-
};
1842+
unsafe { clang_Type_getNumTemplateArguments(ty.x) };
18621843
if num_template_args >= 0 {
18631844
print_indent(
18641845
depth,

0 commit comments

Comments
 (0)