diff options
Diffstat (limited to 'libbindgen/src/clang.rs')
-rw-r--r-- | libbindgen/src/clang.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbindgen/src/clang.rs b/libbindgen/src/clang.rs index 3f272607..192ce09d 100644 --- a/libbindgen/src/clang.rs +++ b/libbindgen/src/clang.rs @@ -402,12 +402,12 @@ impl Cursor { /// Given that this cursor's referent is a `typedef`, get the `Type` that is /// being aliased. - pub fn typedef_type(&self) -> Type { - unsafe { - Type { - x: clang_getTypedefDeclUnderlyingType(self.x), - } - } + pub fn typedef_type(&self) -> Option<Type> { + let inner = Type { + x: unsafe { clang_getTypedefDeclUnderlyingType(self.x) } + }; + + if inner.is_valid() { Some(inner) } else { None } } /// Get the linkage kind for this cursor's referent. |