diff --git a/src/clang.rs b/src/clang.rs index 6233adea47..0143c4db74 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -455,6 +455,13 @@ impl Type { clang_getFunctionTypeCallingConv(self.x) } } + + #[cfg(not(feature="llvm_stable"))] + pub fn named(&self) -> Type { + unsafe { + Type { x: clang_Type_getNamedType(self.x) } + } + } } // SourceLocation @@ -955,6 +962,11 @@ pub fn type_to_str(x: Enum_CXTypeKind) -> &'static str { CXType_IncompleteArray => "IncompleteArray", CXType_VariableArray => "VariableArray", CXType_DependentSizedArray => "DependentSizedArray", + CXType_MemberPointer => "MemberPointer", + #[cfg(not(feature="llvm_stable"))] + CXType_Auto => "Auto", + #[cfg(not(feature="llvm_stable"))] + CXType_Elaborated => "Elaborated", _ => "?" } } diff --git a/src/clangll.rs b/src/clangll.rs index dd83669495..b94356bcbc 100644 --- a/src/clangll.rs +++ b/src/clangll.rs @@ -408,6 +408,10 @@ pub const CXType_IncompleteArray: c_uint = 114; pub const CXType_VariableArray: c_uint = 115; pub const CXType_DependentSizedArray: c_uint = 116; pub const CXType_MemberPointer: c_uint = 117; +#[cfg(not(feature="llvm_stable"))] +pub const CXType_Auto: c_uint = 118; +#[cfg(not(feature="llvm_stable"))] +pub const CXType_Elaborated: c_uint = 119; pub type Enum_CXCallingConv = c_uint; pub const CXCallingConv_Default: c_uint = 0; pub const CXCallingConv_C: c_uint = 1; @@ -1108,6 +1112,8 @@ extern "C" { pub fn clang_Type_getNumTemplateArguments(T: CXType) -> c_int; pub fn clang_Type_getTemplateArgumentAsType(T: CXType, i: c_int) -> CXType; + #[cfg(not(feature="llvm_stable"))] + pub fn clang_Type_getNamedType(CT: CXType) -> CXType; pub fn clang_Cursor_isBitField(C: CXCursor) -> c_uint; #[cfg(not(feature="llvm_stable"))] pub fn clang_Cursor_isFunctionInlined(C: CXCursor) -> c_uint; diff --git a/src/parser.rs b/src/parser.rs index 18a87a58b9..1acf1c6085 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -490,6 +490,8 @@ fn conv_ty_resolving_typedefs(ctx: &mut ClangParserCtx, CXType_Unexposed | CXType_Enum => conv_decl_ty_resolving_typedefs(ctx, ty, cursor, resolve_typedefs), CXType_ConstantArray => TArray(Box::new(conv_ty_resolving_typedefs(ctx, &ty.elem_type(), cursor, resolve_typedefs)), ty.array_size(), layout), + #[cfg(not(feature="llvm_stable"))] + CXType_Elaborated => conv_ty_resolving_typedefs(ctx, &ty.named(), cursor, resolve_typedefs), _ => { let fail = ctx.options.fail_on_unknown_type; log_err_warn(ctx, diff --git a/tests/expectations/elaborated.rs b/tests/expectations/elaborated.rs new file mode 100644 index 0000000000..366c6882ce --- /dev/null +++ b/tests/expectations/elaborated.rs @@ -0,0 +1,7 @@ +/* automatically generated by rust-bindgen */ + +pub type whatever_t = ::std::os::raw::c_int; +extern "C" { + #[link_name = "_Z9somethingPKi"] + pub fn something(wat: *const whatever_t); +} diff --git a/tests/headers/elaborated.hpp b/tests/headers/elaborated.hpp new file mode 100644 index 0000000000..4bfbff23dd --- /dev/null +++ b/tests/headers/elaborated.hpp @@ -0,0 +1,5 @@ +namespace whatever { + typedef int whatever_t; +} + +void something(const whatever::whatever_t *wat);