mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-09-19 11:09:05 +01:00
Correct offset calculation with multiple base classes (#494)
If a class inherits from more than one base class Clang Parser currently calculates incorrect offsets for everything but the first base class. This is owing to the fact that TypeGraph needs offsets in bits but ClangParser is providing them in bytes.
This commit is contained in:
parent
472a7366ee
commit
479545d4b8
@ -335,7 +335,8 @@ void ClangTypeParser::enumerateClassParents(const clang::RecordType& ty,
|
||||
if (baseCxxDecl == nullptr)
|
||||
continue;
|
||||
|
||||
auto offset = layout.getBaseClassOffset(baseCxxDecl).getQuantity();
|
||||
auto offset =
|
||||
layout.getBaseClassOffset(baseCxxDecl).getQuantity() * CHAR_BIT;
|
||||
auto& ptype = enumerateType(*baseType);
|
||||
parents.emplace_back(Parent{ptype, static_cast<uint64_t>(offset)});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user