Skip to content

Allow inspecting sizes and alignment of types

Milian Wolff requested to merge work/type-sizeof-alignof into master

Previously we only supported this information for class declarations and class members. But I find myself wanting to inspect this information frequently for other types too, most notably type aliases that instantiate a template.

Move the data from the ClassMemberDeclaration to the abstract type and set it for all C++/C types we encounter that have that data. Explicitly filter out function types, because we get strange data there with libclang: sizeof 1, alignof 4? In reality one cannot directly apply sizeof to a function anyways

Also only unalias the types in the navigation context instead of fully dereference them, as that would break the sizeof for pointers.

As this changes the layout of the on-disk DUChain data, we have to bump our cache version number and trigger a full reparse.

@igorkushnir @apol @dakon

Edited by Milian Wolff

Merge request reports