Pass a couple of pointer tests
All checks were successful
CI / ci (Release, ubuntu-latest) (pull_request) Successful in 1m5s
CI / ci (MinSizeRel, ubuntu-latest) (pull_request) Successful in 1m10s
CI / ci (RelWithDebInfo, ubuntu-latest) (pull_request) Successful in 1m9s
CI / ci (Debug, ubuntu-latest) (pull_request) Successful in 6m10s
CI / ci (Release, ubuntu-latest) (push) Successful in 1m5s
CI / ci (MinSizeRel, ubuntu-latest) (push) Successful in 1m10s
CI / ci (RelWithDebInfo, ubuntu-latest) (push) Successful in 1m8s
CI / ci (Debug, ubuntu-latest) (push) Successful in 6m10s

This commit is contained in:
David Gonzalez Martin 2025-06-12 15:09:26 -06:00
parent 0a506b2e01
commit e05d1b137d

View File

@ -7905,7 +7905,31 @@ analyze_type = fn (module: &Module, value: &Value, expected_type: &Type, analysi
},
.pointer_cast =>
{
#trap();
if (!expected_type)
{
report_error();
}
if (expected_type.id != .pointer)
{
report_error();
}
analyze_type(module, unary_value, zero, { .must_be_constant = analysis.must_be_constant, zero });
>value_pointer_type = unary_value.type;
if (value_pointer_type == expected_type)
{
report_error();
}
if (value_pointer_type.id != .pointer)
{
report_error();
}
value_type = expected_type;
},
.enum_name =>
{
@ -9651,6 +9675,14 @@ emit_value = fn (module: &Module, value: &Value, type_kind: TypeKind, expect_con
{
llvm_value = LLVMBuildPtrToInt(module.llvm.builder, llvm_unary_value, resolved_value_type.llvm.abi, "");
},
.pointer_from_int =>
{
llvm_value = LLVMBuildIntToPtr(module.llvm.builder, llvm_unary_value, resolved_value_type.llvm.abi, "");
},
.pointer_cast =>
{
llvm_value = llvm_unary_value;
},
else => { #trap(); },
}
},
@ -11739,6 +11771,8 @@ names: [_][]u8 = [
"basic_string",
"basic_varargs",
"basic_while",
"pointer",
"pointer_cast",
];
[export] main = fn [cc(c)] (argument_count: u32, argv: &&u8, envp: &&u8) s32