summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/clang.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/clang.rs b/src/clang.rs
index c6af517c..e6d78123 100755
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -639,7 +639,7 @@ impl Type {
let ret = Type {
x: unsafe { clang_getPointeeType(self.x) },
};
- debug_assert!(ret.kind() != CXType_Invalid);
+ debug_assert!(ret.is_valid());
Some(ret)
}
_ => None,
@@ -652,7 +652,7 @@ impl Type {
let current_type = Type {
x: unsafe { clang_getElementType(self.x) },
};
- if current_type.kind() != CXType_Invalid {
+ if current_type.is_valid() {
Some(current_type)
} else {
None
@@ -691,10 +691,10 @@ impl Type {
let rt = Type {
x: unsafe { clang_getResultType(self.x) },
};
- if rt.kind() == CXType_Invalid {
- None
- } else {
+ if rt.is_valid() {
Some(rt)
+ } else {
+ None
}
}
@@ -714,6 +714,11 @@ impl Type {
}
}
}
+
+ /// Is this a valid type?
+ pub fn is_valid(&self) -> bool {
+ self.kind() != CXType_Invalid
+ }
}
/// An iterator for a type's template arguments.