mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +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
6d898bed95
commit
20cd48ac63
@ -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