diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-18 14:59:09 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-23 10:19:39 +0000 |
commit | ff0be5aba1c12be49b305e596a7610d197ca8427 (patch) | |
tree | e68205afbbb7e687223bf0c3fafa4fbcbf037970 /sources/shiboken2/ApiExtractor/parser | |
parent | 61edf76aab3cdd0bfcf57b16f6a1c37271e675a5 (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/parser')
-rw-r--r-- | sources/shiboken2/ApiExtractor/parser/codemodel.cpp | 32 | ||||
-rw-r--r-- | sources/shiboken2/ApiExtractor/parser/codemodel.h | 4 |
2 files changed, 11 insertions, 25 deletions
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp index a560c0faf..2c8042dc0 100644 --- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp @@ -449,9 +449,7 @@ _CodeModelItem::_CodeModelItem(CodeModel *model, const QString &name, int kind) { } -_CodeModelItem::~_CodeModelItem() -{ -} +_CodeModelItem::~_CodeModelItem() = default; int _CodeModelItem::kind() const { @@ -623,9 +621,7 @@ QDebug operator<<(QDebug d, const _CodeModelItem *t) #endif // !QT_NO_DEBUG_STREAM // --------------------------------------------------------------------------- -_ClassModelItem::~_ClassModelItem() -{ -} +_ClassModelItem::~_ClassModelItem() = default; TemplateParameterList _ClassModelItem::templateParameters() const { @@ -715,9 +711,7 @@ FunctionModelItem _ScopeModelItem::declaredFunction(FunctionModelItem item) return FunctionModelItem(); } -_ScopeModelItem::~_ScopeModelItem() -{ -} +_ScopeModelItem::~_ScopeModelItem() = default; void _ScopeModelItem::addEnumsDeclaration(const QString &enumsDeclaration) { @@ -926,11 +920,9 @@ void _ArgumentModelItem::formatDebug(QDebug &d) const } #endif // !QT_NO_DEBUG_STREAM // --------------------------------------------------------------------------- -_FunctionModelItem::~_FunctionModelItem() -{ -} +_FunctionModelItem::~_FunctionModelItem() = default; -bool _FunctionModelItem::isSimilar(FunctionModelItem other) const +bool _FunctionModelItem::isSimilar(const FunctionModelItem &other) const { if (name() != other->name()) return false; @@ -962,7 +954,7 @@ ArgumentList _FunctionModelItem::arguments() const return m_arguments; } -void _FunctionModelItem::addArgument(ArgumentModelItem item) +void _FunctionModelItem::addArgument(const ArgumentModelItem& item) { m_arguments.append(item); } @@ -1182,9 +1174,7 @@ void _EnumModelItem::formatDebug(QDebug &d) const #endif // !QT_NO_DEBUG_STREAM // --------------------------------------------------------------------------- -_EnumeratorModelItem::~_EnumeratorModelItem() -{ -} +_EnumeratorModelItem::~_EnumeratorModelItem() = default; QString _EnumeratorModelItem::stringValue() const { @@ -1205,9 +1195,7 @@ void _EnumeratorModelItem::formatDebug(QDebug &d) const #endif // !QT_NO_DEBUG_STREAM // --------------------------------------------------------------------------- -_TemplateParameterModelItem::~_TemplateParameterModelItem() -{ -} +_TemplateParameterModelItem::~_TemplateParameterModelItem() = default; TypeInfo _TemplateParameterModelItem::type() const { @@ -1255,9 +1243,7 @@ CodeModel::AccessPolicy _MemberModelItem::accessPolicy() const return m_accessPolicy; } -_MemberModelItem::~_MemberModelItem() -{ -} +_MemberModelItem::~_MemberModelItem() = default; void _MemberModelItem::setAccessPolicy(CodeModel::AccessPolicy accessPolicy) { diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h index c61f640e1..a2cbcd6c0 100644 --- a/sources/shiboken2/ApiExtractor/parser/codemodel.h +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h @@ -568,7 +568,7 @@ public: ArgumentList arguments() const; - void addArgument(ArgumentModelItem item); + void addArgument(const ArgumentModelItem& item); CodeModel::FunctionType functionType() const; void setFunctionType(CodeModel::FunctionType functionType); @@ -603,7 +603,7 @@ public: bool isVariadics() const; void setVariadics(bool isVariadics); - bool isSimilar(FunctionModelItem other) const; + bool isSimilar(const FunctionModelItem &other) const; #ifndef QT_NO_DEBUG_STREAM void formatDebug(QDebug &d) const override; |