mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
translate-c: handle more wrapper types in isAnyopaque
This commit is contained in:
parent
0909f47f86
commit
72443fb88c
@ -4926,6 +4926,22 @@ fn isAnyopaque(qt: clang.QualType) bool {
|
||||
const typedef_decl = typedef_ty.getDecl();
|
||||
return isAnyopaque(typedef_decl.getUnderlyingType());
|
||||
},
|
||||
.Elaborated => {
|
||||
const elaborated_ty = @ptrCast(*const clang.ElaboratedType, ty);
|
||||
return isAnyopaque(elaborated_ty.getNamedType().getCanonicalType());
|
||||
},
|
||||
.Decayed => {
|
||||
const decayed_ty = @ptrCast(*const clang.DecayedType, ty);
|
||||
return isAnyopaque(decayed_ty.getDecayedType().getCanonicalType());
|
||||
},
|
||||
.Attributed => {
|
||||
const attributed_ty = @ptrCast(*const clang.AttributedType, ty);
|
||||
return isAnyopaque(attributed_ty.getEquivalentType().getCanonicalType());
|
||||
},
|
||||
.MacroQualified => {
|
||||
const macroqualified_ty = @ptrCast(*const clang.MacroQualifiedType, ty);
|
||||
return isAnyopaque(macroqualified_ty.getModifiedType().getCanonicalType());
|
||||
},
|
||||
else => return false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -3026,7 +3026,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
||||
\\pub export fn log2(arg_a: u32) c_int {
|
||||
\\ var a = arg_a;
|
||||
\\ var i: c_int = 0;
|
||||
\\ while (a > @bitCast(c_uint, @as(c_int, 0))) {
|
||||
\\ while (a > @bitCast(u32, @as(c_int, 0))) {
|
||||
\\ a >>= @intCast(@import("std").math.Log2Int(c_int), @as(c_int, 1));
|
||||
\\ }
|
||||
\\ return i;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user