mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 11:09:05 +01:00
clangparser: provide alignment info for members
Unlike DWARF, the Clang AST is capable of correctly calculating the alignment for each member. If we do this then AlignmentCalc doesn't traverse into the member to attempt to calculate the alignment. This check might be wrong if the field has explicit alignment. That case can be covered when we have proper integration testing and a repro. Test plan: - Without this lots of static asserts occur. With this it's okay.
This commit is contained in:
parent
20cd48ac63
commit
c5ecb9aaa2
@ -294,6 +294,7 @@ void ClangTypeParser::enumerateClassMembers(const clang::RecordType& ty,
|
||||
|
||||
auto& mtype = enumerateType(*qualType);
|
||||
Member m{mtype, std::move(member_name), offset_in_bits, size_in_bits};
|
||||
m.align = decl->getASTContext().getTypeAlign(qualType) / 8;
|
||||
members.push_back(m);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user