mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-13 22:06:55 +00:00
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:
parent
851901d690
commit
6c192f7e58
@ -183,7 +183,12 @@ Type& ClangTypeParser::enumerateClass(const clang::RecordType& ty) {
|
|||||||
|
|
||||||
std::string name = decl->getNameAsString();
|
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;
|
int virtuality = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user