mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 02:59: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
6c192f7e58
commit
976e319e14
@ -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