mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
CodeGen: Apply "alignas" to all stubbed types
Stubbing types listed in OICodeGen's "typesToStub" leaves them in the same state as stubbed unions, so they need the same handling.
This commit is contained in:
parent
6d30015764
commit
ed2c6f357d
@ -267,10 +267,14 @@ void genDefsClass(const Class& c, std::string& code) {
|
||||
code += "__attribute__((__packed__)) ";
|
||||
}
|
||||
|
||||
if (c.kind() == Class::Kind::Union) {
|
||||
// Need to specify alignment manually for unions as their members have been
|
||||
// removed. It would be nice to do this for all types, but our alignment
|
||||
// information is not complete, so it would result in some errors.
|
||||
if (c.members.size() == 1 &&
|
||||
c.members[0].name.starts_with(AddPadding::MemberPrefix)) {
|
||||
// Need to specify alignment manually for types which have been stubbed.
|
||||
// It would be nice to do this for all types, but our alignment information
|
||||
// is not complete, so it would result in some errors.
|
||||
//
|
||||
// Once we are able to read alignment info from DWARF, then this should be
|
||||
// able to be applied to everything.
|
||||
code += "alignas(" + std::to_string(c.align()) + ") ";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user