Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick C ABI fix #5911

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/compiler/gen_llvm/src/llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5910,8 +5910,18 @@ fn to_cc_type<'a, 'ctx>(
layout_interner: &STLayoutInterner<'a>,
layout: InLayout<'a>,
) -> BasicTypeEnum<'ctx> {
match layout_interner.runtime_representation(layout) {
let layout_repr = layout_interner.runtime_representation(layout);
match layout_repr {
LayoutRepr::Builtin(builtin) => to_cc_type_builtin(env, &builtin),
LayoutRepr::Struct(_) => {
let stack_type = basic_type_from_layout(env, layout_interner, layout_repr);

if layout_repr.is_passed_by_reference(layout_interner) {
stack_type.ptr_type(AddressSpace::default()).into()
} else {
stack_type
}
}
_ => {
// TODO this is almost certainly incorrect for bigger structs
basic_type_from_layout(env, layout_interner, layout_interner.get_repr(layout))
Expand Down