Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
[spv-in] fix struct spans for layout-less structs
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Aug 10, 2021
1 parent 021bfd5 commit 07c2862
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/front/spv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3090,15 +3090,17 @@ impl<I: Iterator<Item = u32>> Parser<I> {

let inner = crate::TypeInner::Struct {
top_level: block_decor.is_some(),
span: match members.last() {
Some(member) => {
span: members
.iter()
.map(|member| {
let end = member.offset + module.types[member.ty].inner.span(&module.constants);
((end - 1) | (struct_alignment.get() - 1)) + 1
}
None => 4, //do we support this?
},
})
.max()
.unwrap_or(4), //do we support this?
members,
};

let ty_handle = module.types.append(crate::Type {
name: parent_decor.and_then(|dec| dec.name),
inner,
Expand Down

0 comments on commit 07c2862

Please sign in to comment.