diff --git a/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.h b/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.h --- a/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.h +++ b/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.h @@ -68,7 +68,7 @@ static QString stringFromAccess(const DeclarationPointer& decl); QString declarationName(const DeclarationPointer& decl) const; static QStringList declarationDetails(const DeclarationPointer& decl); - static QString declarationSizeInformation(const DeclarationPointer& decl); + static QString declarationSizeInformation(const DeclarationPointer& decl, const TopDUContext* topContext); ///This can be used for example to resolve typedefs within the type. ///All types that are visualized in the navigation-context are/should be mangled through this. diff --git a/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp b/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp --- a/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp +++ b/kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp @@ -353,7 +353,7 @@ } if (!shorten) { - modifyHtml() += declarationSizeInformation(d->m_declaration); + modifyHtml() += declarationSizeInformation(d->m_declaration, topContext().data()); } if (!shorten && doc) { @@ -841,8 +841,21 @@ return details; } -QString AbstractDeclarationNavigationContext::declarationSizeInformation(const DeclarationPointer& decl) +QString AbstractDeclarationNavigationContext::declarationSizeInformation(const DeclarationPointer& decl, + const TopDUContext* topContext) { + if (!decl) { + return {}; + } + + if (decl->isTypeAlias()) { + // show size information for underlying type of aliases / typedefs etc. + const auto type = TypeUtils::targetType(decl->abstractType(), topContext); + if (const auto* idType = dynamic_cast(type.data())) { + return declarationSizeInformation(DeclarationPointer(idType->declaration(topContext)), topContext); + } + return {}; + } // Note that ClassMemberDeclaration also includes ClassDeclaration, which uses the sizeOf and alignOf fields, // but normally leaves the bitOffsetOf unset (-1). const auto* memberDecl = dynamic_cast(decl.data());