From ddfbbd346b522703a5b6f8d274a7f79983e5f319 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Jun 2019 09:33:27 +0200 Subject: shiboken: Introduce nullptr Apply Fixits by Qt Creator with some amendments. Change-Id: Ie8300ddb834adb8b649324562f2c912a4e8cf4ce Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/abstractmetalang.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.h') diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h index e8ec21f48..6480257c7 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.h +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h @@ -587,7 +587,7 @@ public: } void setType(AbstractMetaType *type) { - Q_ASSERT(m_type == 0); + Q_ASSERT(m_type == nullptr); m_type = type; } void replaceType(AbstractMetaType *type) @@ -896,7 +896,7 @@ public: } void setType(AbstractMetaType *type) { - Q_ASSERT(m_type == 0); + Q_ASSERT(m_type == nullptr); m_type = type; } @@ -1053,12 +1053,12 @@ public: * \return true if there is some modification to function signature */ bool hasSignatureModifications() const; - FunctionModificationList modifications(const AbstractMetaClass* implementor = 0) const; + FunctionModificationList modifications(const AbstractMetaClass* implementor = nullptr) const; /** * Return the argument name if there is a modification the renamed value will be returned */ - QString argumentName(int index, bool create = true, const AbstractMetaClass *cl = 0) const; + QString argumentName(int index, bool create = true, const AbstractMetaClass *cl = nullptr) const; void setPropertySpec(QPropertySpec *spec) { -- cgit v1.2.3 From 7be4e64b4bac6e6b5a90eec74b9f2b661c60db3a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 May 2019 10:45:37 +0200 Subject: shiboken: Replace 'typedef' by 'using' Apply Fixits by Qt Creator with some amendments. Remove iterator types by using auto instead. Change-Id: I8a75323da6ae5cdcc6b67af8be9376408953986b Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/abstractmetalang.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.h') diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h index 6480257c7..779da7d2d 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.h +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h @@ -292,7 +292,7 @@ class AbstractMetaType { Q_GADGET public: - typedef QVector Indirections; + using Indirections = QVector; enum TypeUsagePattern { InvalidPattern, -- cgit v1.2.3 From 4ccfd8de6462ce2ed938587eb0518038640c310f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 May 2019 14:59:09 +0200 Subject: shiboken: Fix various clang warnings - Avoid copying complex types by using const ref - Use isEmpty() to check for container emptyness - Use range-based for - Use Q_DISABLE_COPY in 'public:' area - Fix spelling error - Use '= default' for trivial constructors/destructors - Remove non-null checks before deletion - Fix misleading indentation - Fix else after return - Simplify boolean expressions - Fix unused parameters, streamline code Change-Id: I8c6cadd8653e220ba8e5bdb4dd55524d13a81768 Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/abstractmetalang.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.h') diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h index 779da7d2d..afb4e5fbd 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.h +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h @@ -72,7 +72,7 @@ public: Target }; - Documentation() {} + Documentation() = default; Documentation(const QString& value, Format fmt = Documentation::Native) : m_data(value.trimmed()), m_format(fmt) {} @@ -105,9 +105,10 @@ private: class AbstractMetaAttributes { - Q_DISABLE_COPY(AbstractMetaAttributes) Q_GADGET public: + Q_DISABLE_COPY(AbstractMetaAttributes) + AbstractMetaAttributes(); virtual ~AbstractMetaAttributes(); @@ -592,8 +593,7 @@ public: } void replaceType(AbstractMetaType *type) { - if (m_type) - delete m_type; + delete m_type; m_type = type; } @@ -902,8 +902,7 @@ public: void replaceType(AbstractMetaType *type) { - if (m_type) - delete m_type; + delete m_type; m_type = type; } @@ -1132,7 +1131,7 @@ QDebug operator<<(QDebug d, const AbstractMetaFunction *af); class AbstractMetaEnumValue { public: - AbstractMetaEnumValue() {} + AbstractMetaEnumValue() = default; EnumValue value() const { @@ -1507,7 +1506,7 @@ public: m_innerClasses << cl; } - void setInnerClasses(AbstractMetaClassList innerClasses) + void setInnerClasses(const AbstractMetaClassList &innerClasses) { m_innerClasses = innerClasses; } -- cgit v1.2.3