CPlusPlus: Inline some simple central functions

Depending on context, callgrind sees contributions of >8% to
the total cost of project parsing for these functions. The
functional are actualy executed executed out-of-line, often
for a function body of one "payload" instruction only.

Inlining removes the call/endbr64/ret overhead.

Change-Id: I6886f08e322fcaa4e0f54d424279e0a8c24e4718
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-06-23 16:56:36 +02:00
parent 85cd97a334
commit ffa3aad576
43 changed files with 532 additions and 1213 deletions

View File

@@ -105,17 +105,17 @@ void ParserTreeItemPrivate::mergeSymbol(const CPlusPlus::Symbol *symbol)
// any symbol which does not contain :: in the name
//! \todo collect statistics and reorder to optimize
if (symbol->isForwardClassDeclaration()
if (symbol->asForwardClassDeclaration()
|| symbol->isExtern()
|| symbol->isFriend()
|| symbol->isGenerated()
|| symbol->isUsingNamespaceDirective()
|| symbol->isUsingDeclaration()
|| symbol->asUsingNamespaceDirective()
|| symbol->asUsingDeclaration()
)
return;
const CPlusPlus::Name *symbolName = symbol->name();
if (symbolName && symbolName->isQualifiedNameId())
if (symbolName && symbolName->asQualifiedNameId())
return;
QString name = g_overview.prettyName(symbolName).trimmed();
@@ -139,7 +139,7 @@ void ParserTreeItemPrivate::mergeSymbol(const CPlusPlus::Symbol *symbol)
childItem->d->m_symbolLocations.insert(location);
// prevent showing a content of the functions
if (!symbol->isFunction()) {
if (!symbol->asFunction()) {
if (const CPlusPlus::Scope *scope = symbol->asScope()) {
CPlusPlus::Scope::iterator cur = scope->memberBegin();
CPlusPlus::Scope::iterator last = scope->memberEnd();
@@ -155,7 +155,7 @@ void ParserTreeItemPrivate::mergeSymbol(const CPlusPlus::Symbol *symbol)
}
// if item is empty and has not to be added
if (!symbol->isNamespace() || childItem->childCount())
if (!symbol->asNamespace() || childItem->childCount())
m_symbolInformations.insert(information, childItem);
}