upgrade enum discriminants
This commit is contained in:
@@ -502,7 +502,7 @@ translate_type :: proc(ctx: ^Context, value: CXType, preferred_record_name := ""
|
||||
params: [dynamic]Type_Id
|
||||
params.allocator = ctx.allocator
|
||||
for index in 0..<count {
|
||||
param := translate_type(ctx, ctx.api.get_arg_type(value, u32(index)), "", depth+1)
|
||||
param := translate_parameter_type(ctx, ctx.api.get_arg_type(value, u32(index)), depth+1)
|
||||
append(¶ms, param)
|
||||
if param == INVALID_TYPE {
|
||||
delete(params)
|
||||
@@ -537,6 +537,30 @@ translate_type :: proc(ctx: ^Context, value: CXType, preferred_record_name := ""
|
||||
return INVALID_TYPE
|
||||
}
|
||||
|
||||
translate_parameter_type :: proc(ctx: ^Context, value: CXType, depth := 0) -> Type_Id {
|
||||
if depth > 64 {
|
||||
return INVALID_TYPE
|
||||
}
|
||||
array := value
|
||||
if value.kind != CXType_ConstantArray && value.kind != CXType_IncompleteArray {
|
||||
canonical := ctx.api.get_canonical_type(value)
|
||||
if canonical.kind != CXType_ConstantArray && canonical.kind != CXType_IncompleteArray {
|
||||
return translate_type(ctx, value, "", depth+1)
|
||||
}
|
||||
array = canonical
|
||||
}
|
||||
element := ctx.api.get_array_element_type(array)
|
||||
child := translate_type(ctx, element, "", depth+1)
|
||||
if child == INVALID_TYPE {
|
||||
return INVALID_TYPE
|
||||
}
|
||||
return add_type(ctx, Type{
|
||||
kind=.Pointer,
|
||||
child=child,
|
||||
mutable=ctx.api.is_const_qualified_type(element) == 0,
|
||||
})
|
||||
}
|
||||
|
||||
has_named :: proc(items: []Unsupported, name: string) -> bool {
|
||||
for item in items {
|
||||
if item.name == name {
|
||||
@@ -1385,7 +1409,7 @@ visit_cursor :: proc "c"(cursor, parent: CXCursor, client_data: rawptr) -> i32 {
|
||||
reason = "function declaration has no prototype"
|
||||
} else {
|
||||
for index in 0..<count {
|
||||
param := translate_type(ctx, ctx.api.get_arg_type(function_type, u32(index)))
|
||||
param := translate_parameter_type(ctx, ctx.api.get_arg_type(function_type, u32(index)))
|
||||
append(¶ms, param)
|
||||
if param == INVALID_TYPE && len(reason) == 0 {
|
||||
reason = "function parameter type is not supported"
|
||||
|
||||
Reference in New Issue
Block a user