Skip to content

Commit c9c02ba

Browse files
committed
Add support for elaborated types.
1 parent 29af048 commit c9c02ba

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/clang.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,12 @@ impl Type {
446446
clang_getFunctionTypeCallingConv(self.x)
447447
}
448448
}
449+
450+
pub fn named(&self) -> Type {
451+
unsafe {
452+
Type { x: clang_Type_getNamedType(self.x) }
453+
}
454+
}
449455
}
450456

451457
// SourceLocation
@@ -946,6 +952,9 @@ pub fn type_to_str(x: Enum_CXTypeKind) -> &'static str {
946952
CXType_IncompleteArray => "IncompleteArray",
947953
CXType_VariableArray => "VariableArray",
948954
CXType_DependentSizedArray => "DependentSizedArray",
955+
CXType_MemberPointer => "CXType_MemberPointer",
956+
CXType_Auto => "CXType_Auto",
957+
CXType_Elaborated => "CXType_Elaborated",
949958
_ => "?"
950959
}
951960
}

src/clangll.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ pub const CXType_IncompleteArray: c_uint = 114;
408408
pub const CXType_VariableArray: c_uint = 115;
409409
pub const CXType_DependentSizedArray: c_uint = 116;
410410
pub const CXType_MemberPointer: c_uint = 117;
411+
pub const CXType_Auto: c_uint = 118;
412+
pub const CXType_Elaborated: c_uint = 119;
411413
pub type Enum_CXCallingConv = c_uint;
412414
pub const CXCallingConv_Default: c_uint = 0;
413415
pub const CXCallingConv_C: c_uint = 1;
@@ -1108,6 +1110,7 @@ extern "C" {
11081110
pub fn clang_Type_getNumTemplateArguments(T: CXType) -> c_int;
11091111
pub fn clang_Type_getTemplateArgumentAsType(T: CXType, i: c_int) ->
11101112
CXType;
1113+
pub fn clang_Type_getNamedType(CT: CXType) -> CXType;
11111114
pub fn clang_Cursor_isBitField(C: CXCursor) -> c_uint;
11121115
pub fn clang_Cursor_isFunctionInlined(C: CXCursor) -> c_uint;
11131116
pub fn clang_isVirtualBase(arg1: CXCursor) -> c_uint;

src/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ fn conv_ty_resolving_typedefs(ctx: &mut ClangParserCtx,
489489
CXType_Unexposed |
490490
CXType_Enum => conv_decl_ty_resolving_typedefs(ctx, ty, cursor, resolve_typedefs),
491491
CXType_ConstantArray => TArray(Box::new(conv_ty_resolving_typedefs(ctx, &ty.elem_type(), cursor, resolve_typedefs)), ty.array_size(), layout),
492+
CXType_Elaborated => conv_ty_resolving_typedefs(ctx, &ty.named(), cursor, resolve_typedefs),
492493
_ => {
493494
let fail = ctx.options.fail_on_unknown_type;
494495
log_err_warn(ctx,

0 commit comments

Comments
 (0)