clangparser: provide correct kind for classes/unions

Previously ClangTypeParser assumed all RecordTypes were structs. This is fine
for structs and classes but completely incorrect for unions. Check which type
it is and give type graph the correct one.

Test plan:
- Unions static assert without this change because their size/alignment is
  wrong.
This commit is contained in:
Jake Hillion 2023-12-20 15:54:50 +00:00
parent 851901d690
commit 6c192f7e58

View File

@ -183,7 +183,12 @@ Type& ClangTypeParser::enumerateClass(const clang::RecordType& ty) {
std::string name = decl->getNameAsString();
auto kind = Class::Kind::Struct; // TODO: kind
auto kind = Class::Kind::Struct;
if (ty.isUnionType()) {
kind = Class::Kind::Union;
} else if (ty.isClassType()) {
kind = Class::Kind::Class;
}
int virtuality = 0;