Skip to content

Commit 6f73db9

Browse files
author
bors-servo
authored
Auto merge of #6 - servo:add-elab, r=emilio
Add support for elaborated types. Fixes #1.
2 parents 7726d5a + 9309411 commit 6f73db9

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/clang.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,13 @@ impl Type {
455455
clang_getFunctionTypeCallingConv(self.x)
456456
}
457457
}
458+
459+
#[cfg(not(feature="llvm_stable"))]
460+
pub fn named(&self) -> Type {
461+
unsafe {
462+
Type { x: clang_Type_getNamedType(self.x) }
463+
}
464+
}
458465
}
459466

460467
// SourceLocation
@@ -955,6 +962,11 @@ pub fn type_to_str(x: Enum_CXTypeKind) -> &'static str {
955962
CXType_IncompleteArray => "IncompleteArray",
956963
CXType_VariableArray => "VariableArray",
957964
CXType_DependentSizedArray => "DependentSizedArray",
965+
CXType_MemberPointer => "MemberPointer",
966+
#[cfg(not(feature="llvm_stable"))]
967+
CXType_Auto => "Auto",
968+
#[cfg(not(feature="llvm_stable"))]
969+
CXType_Elaborated => "Elaborated",
958970
_ => "?"
959971
}
960972
}

src/clangll.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,10 @@ 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+
#[cfg(not(feature="llvm_stable"))]
412+
pub const CXType_Auto: c_uint = 118;
413+
#[cfg(not(feature="llvm_stable"))]
414+
pub const CXType_Elaborated: c_uint = 119;
411415
pub type Enum_CXCallingConv = c_uint;
412416
pub const CXCallingConv_Default: c_uint = 0;
413417
pub const CXCallingConv_C: c_uint = 1;
@@ -1108,6 +1112,8 @@ extern "C" {
11081112
pub fn clang_Type_getNumTemplateArguments(T: CXType) -> c_int;
11091113
pub fn clang_Type_getTemplateArgumentAsType(T: CXType, i: c_int) ->
11101114
CXType;
1115+
#[cfg(not(feature="llvm_stable"))]
1116+
pub fn clang_Type_getNamedType(CT: CXType) -> CXType;
11111117
pub fn clang_Cursor_isBitField(C: CXCursor) -> c_uint;
11121118
#[cfg(not(feature="llvm_stable"))]
11131119
pub fn clang_Cursor_isFunctionInlined(C: CXCursor) -> c_uint;

src/parser.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ fn conv_ty_resolving_typedefs(ctx: &mut ClangParserCtx,
490490
CXType_Unexposed |
491491
CXType_Enum => conv_decl_ty_resolving_typedefs(ctx, ty, cursor, resolve_typedefs),
492492
CXType_ConstantArray => TArray(Box::new(conv_ty_resolving_typedefs(ctx, &ty.elem_type(), cursor, resolve_typedefs)), ty.array_size(), layout),
493+
#[cfg(not(feature="llvm_stable"))]
494+
CXType_Elaborated => conv_ty_resolving_typedefs(ctx, &ty.named(), cursor, resolve_typedefs),
493495
_ => {
494496
let fail = ctx.options.fail_on_unknown_type;
495497
log_err_warn(ctx,

0 commit comments

Comments
 (0)