Differential D18097 Diff 48961 kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp
Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/language/duchain/navigation/abstractdeclarationnavigationcontext.cpp
Show First 20 Lines • Show All 347 Lines • ▼ Show 20 Line(s) | 343 | if (!Qt::mightBeRichText(comment)) { | |||
---|---|---|---|---|---|
348 | comment.replace(QLatin1Char('\n'), QLatin1String("<br />")); //Replicate newlines in html | 348 | comment.replace(QLatin1Char('\n'), QLatin1String("<br />")); //Replicate newlines in html | ||
349 | } | 349 | } | ||
350 | modifyHtml() += commentHighlight(comment); | 350 | modifyHtml() += commentHighlight(comment); | ||
351 | modifyHtml() += QStringLiteral("</p>"); | 351 | modifyHtml() += QStringLiteral("</p>"); | ||
352 | } | 352 | } | ||
353 | } | 353 | } | ||
354 | 354 | | |||
355 | if (!shorten) { | 355 | if (!shorten) { | ||
356 | modifyHtml() += declarationSizeInformation(d->m_declaration); | 356 | modifyHtml() += declarationSizeInformation(d->m_declaration, topContext().data()); | ||
357 | } | 357 | } | ||
358 | 358 | | |||
359 | if (!shorten && doc) { | 359 | if (!shorten && doc) { | ||
360 | modifyHtml() += QLatin1String("<p>") + i18n("Show documentation for "); | 360 | modifyHtml() += QLatin1String("<p>") + i18n("Show documentation for "); | ||
361 | makeLink(prettyQualifiedName(d->m_declaration), | 361 | makeLink(prettyQualifiedName(d->m_declaration), | ||
362 | d->m_declaration, NavigationAction::ShowDocumentation); | 362 | d->m_declaration, NavigationAction::ShowDocumentation); | ||
363 | modifyHtml() += QStringLiteral("</p>"); | 363 | modifyHtml() += QStringLiteral("</p>"); | ||
364 | } | 364 | } | ||
▲ Show 20 Lines • Show All 471 Lines • ▼ Show 20 Line(s) | 823 | if (classFunDecl) { | |||
836 | if (classFunDecl->isAbstract()) | 836 | if (classFunDecl->isAbstract()) | ||
837 | details << QStringLiteral("abstract"); | 837 | details << QStringLiteral("abstract"); | ||
838 | } | 838 | } | ||
839 | } | 839 | } | ||
840 | 840 | | |||
841 | return details; | 841 | return details; | ||
842 | } | 842 | } | ||
843 | 843 | | |||
844 | QString AbstractDeclarationNavigationContext::declarationSizeInformation(const DeclarationPointer& decl) | 844 | QString AbstractDeclarationNavigationContext::declarationSizeInformation(const DeclarationPointer& decl, | ||
845 | const TopDUContext* topContext) | ||||
845 | { | 846 | { | ||
847 | if (!decl) { | ||||
848 | return {}; | ||||
849 | } | ||||
850 | | ||||
851 | if (decl->isTypeAlias()) { | ||||
852 | // show size information for underlying type of aliases / typedefs etc. | ||||
853 | const auto type = TypeUtils::targetType(decl->abstractType(), topContext); | ||||
854 | if (const auto* idType = dynamic_cast<const IdentifiedType*>(type.data())) { | ||||
855 | return declarationSizeInformation(DeclarationPointer(idType->declaration(topContext)), topContext); | ||||
856 | } | ||||
857 | return {}; | ||||
858 | } | ||||
846 | // Note that ClassMemberDeclaration also includes ClassDeclaration, which uses the sizeOf and alignOf fields, | 859 | // Note that ClassMemberDeclaration also includes ClassDeclaration, which uses the sizeOf and alignOf fields, | ||
847 | // but normally leaves the bitOffsetOf unset (-1). | 860 | // but normally leaves the bitOffsetOf unset (-1). | ||
848 | const auto* memberDecl = dynamic_cast<const ClassMemberDeclaration*>(decl.data()); | 861 | const auto* memberDecl = dynamic_cast<const ClassMemberDeclaration*>(decl.data()); | ||
849 | if (memberDecl && (memberDecl->bitOffsetOf() > 0 || memberDecl->sizeOf() > 0 || memberDecl->alignOf() > 0)) { | 862 | if (memberDecl && (memberDecl->bitOffsetOf() > 0 || memberDecl->sizeOf() > 0 || memberDecl->alignOf() > 0)) { | ||
850 | QString sizeInfo = QStringLiteral("<p>"); | 863 | QString sizeInfo = QStringLiteral("<p>"); | ||
851 | 864 | | |||
852 | if (memberDecl->bitOffsetOf() >= 0) { | 865 | if (memberDecl->bitOffsetOf() >= 0) { | ||
853 | const auto byteOffset = memberDecl->bitOffsetOf() / 8; | 866 | const auto byteOffset = memberDecl->bitOffsetOf() / 8; | ||
Show All 23 Lines |