[fidl] Fix struct field alignment in fidl frontend
Change-Id: I00ba9522f59761d23b6d868270b59ccdeee06ac1
diff --git a/system/host/fidl/lib/flat_ast.cpp b/system/host/fidl/lib/flat_ast.cpp
index 7f9995b..2c56be0 100644
--- a/system/host/fidl/lib/flat_ast.cpp
+++ b/system/host/fidl/lib/flat_ast.cpp
@@ -58,10 +58,10 @@
uint32_t alignment = 1u;
for (FieldShape* field : *fields) {
- field->SetOffset(size);
TypeShape typeshape = field->Typeshape();
alignment = std::max(alignment, typeshape.Alignment());
size = AlignTo(size, typeshape.Alignment());
+ field->SetOffset(size);
size += typeshape.Size();
}