aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-02-25 01:24:12 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-02-27 14:20:39 +0000
commit956bf1362c596aaa023147d3f6497dc2500a2429 (patch)
treec94e760bd2b933b3452a3bd9debf16ad21486e56 /src
parentb8d463545037f031f7038eb8c34c92b14bfdade9 (diff)
Avoid useless allocations in Item::propertyDeclaration
PropertyDeclaration() allocates Private class which can be easily avoided by using iterator API Change-Id: I8240fe845b8a4d8f3ad8f8372f5bca178982ab29 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/lib/corelib/language/item.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/corelib/language/item.cpp b/src/lib/corelib/language/item.cpp
index 9f754bdd7..a86cfeac1 100644
--- a/src/lib/corelib/language/item.cpp
+++ b/src/lib/corelib/language/item.cpp
@@ -203,15 +203,15 @@ bool Item::isOfTypeOrhasParentOfType(ItemType type) const
PropertyDeclaration Item::propertyDeclaration(const QString &name, bool allowExpired) const
{
- PropertyDeclaration decl = m_propertyDeclarations.value(name);
- if (decl.isValid())
- return decl;
+ auto it = m_propertyDeclarations.find(name);
+ if (it != m_propertyDeclarations.end())
+ return it.value();
if (allowExpired) {
- decl = m_expiredPropertyDeclarations.value(name);
- if (decl.isValid())
- return decl;
+ it = m_expiredPropertyDeclarations.find(name);
+ if (it != m_expiredPropertyDeclarations.end())
+ return it.value();
}
- return m_prototype ? m_prototype->propertyDeclaration(name) : decl;
+ return m_prototype ? m_prototype->propertyDeclaration(name) : PropertyDeclaration();
}
void Item::addModule(const Item::Module &module)