aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystem.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-18 14:59:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-23 10:19:39 +0000
commitff0be5aba1c12be49b305e596a7610d197ca8427 (patch)
treee68205afbbb7e687223bf0c3fafa4fbcbf037970 /sources/shiboken2/ApiExtractor/typesystem.cpp
parent61edf76aab3cdd0bfcf57b16f6a1c37271e675a5 (diff)
Fix some clang-tidy warnings in shiboken
- 'else if' after return/break/continue - Use const ref for complex arguments passed by value where possible - Fix 'if (foo) delete foo' to 'delete foo' - Use container.isEmpty() instead of container.size() in checks - Use ' = default' for trivial constructors/destructors - Use range based for where possible - Complete constructor initializer lists - Fix invocations of static methods - Replace some reinterpret_cast by static_cast - Remove unused variables/fields - Use initializer lists for return types Change-Id: Id5b44a2f9d429f66ef069d532a1cd31df796d38e Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 716b2b41b..78f8115e0 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -2630,10 +2630,7 @@ PrimitiveTypeEntry *PrimitiveTypeEntry::basicReferencedTypeEntry() const
return 0;
PrimitiveTypeEntry *baseReferencedTypeEntry = m_referencedTypeEntry->basicReferencedTypeEntry();
- if (baseReferencedTypeEntry)
- return baseReferencedTypeEntry;
- else
- return m_referencedTypeEntry;
+ return baseReferencedTypeEntry ? baseReferencedTypeEntry : m_referencedTypeEntry;
}
bool PrimitiveTypeEntry::preferredConversion() const
@@ -2734,10 +2731,7 @@ QString ContainerTypeEntry::qualifiedCppName() const
QString EnumTypeEntry::targetLangQualifier() const
{
TypeEntry *te = TypeDatabase::instance()->findType(m_qualifier);
- if (te)
- return te->targetLangName();
- else
- return m_qualifier;
+ return te ? te->targetLangName() : m_qualifier;
}
QString EnumTypeEntry::qualifiedTargetLangName() const
@@ -2794,7 +2788,7 @@ QString fixCppTypeName(const QString &name)
{
if (name == QLatin1String("long long"))
return QLatin1String("qint64");
- else if (name == QLatin1String("unsigned long long"))
+ if (name == QLatin1String("unsigned long long"))
return QLatin1String("quint64");
return name;
}
@@ -2815,11 +2809,9 @@ QString TemplateInstance::expandCode() const
result += code;
result += QLatin1String("\n// TEMPLATE - ") + m_name + QLatin1String(" - END");
return result;
- } else {
- qCWarning(lcShiboken).noquote().nospace()
- << "insert-template referring to non-existing template '" << m_name << '\'';
}
-
+ qCWarning(lcShiboken).noquote().nospace()
+ << "insert-template referring to non-existing template '" << m_name << '\'';
return QString();
}
@@ -2835,10 +2827,7 @@ QString CodeSnipAbstract::code() const
QString CodeSnipFragment::code() const
{
- if (m_instance)
- return m_instance->expandCode();
- else
- return m_code;
+ return m_instance ? m_instance->expandCode() : m_code;
}
bool FunctionModification::setSignature(const QString &s, QString *errorMessage)
@@ -3176,10 +3165,9 @@ QString ArrayTypeEntry::targetLangName() const
QString ArrayTypeEntry::targetLangApiName() const
{
- if (m_nestedType->isPrimitive())
- return m_nestedType->targetLangApiName() + QLatin1String("Array");
- else
- return QLatin1String("jobjectArray");
+ return m_nestedType->isPrimitive()
+ ? m_nestedType->targetLangApiName() + QLatin1String("Array")
+ : QLatin1String("jobjectArray");
}
EnumTypeEntry::EnumTypeEntry(const QString &nspace, const QString &enumName,