From 181fa70b7ba06c92c3c0fdc4c70081b14e4b1bdf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 16 Jan 2018 15:45:10 +0100 Subject: shiboken: Fix some clazy warnings - Mixing const/non-const iterators - Do not use operator[] on temporaries of type QVector - Remove unused nontrivial variables - Add Q_FALLTHROUGH() - Potential detach in range-based for Change-Id: I89391fdda616f119eadd7de529eb6cee69343f85 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Alexandru Croitor --- sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp') diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index 79d69abf3..32036749d 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -487,7 +487,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom) const QSet &namespaceTypeValues = dom->uniqueNamespaces(); ReportHandler::setProgressReference(namespaceTypeValues); - for (NamespaceModelItem item : namespaceTypeValues) { + for (const NamespaceModelItem &item : namespaceTypeValues) { ReportHandler::progress(QLatin1String("Generating namespace model...")); AbstractMetaClass *metaClass = traverseNamespace(dom, item); if (metaClass) @@ -1143,7 +1143,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(EnumModelItem enumIte // Register all enum values on Type database const EnumeratorList &enumerators = enumItem->enumerators(); - for (EnumeratorModelItem e : enumItem->enumerators()) { + for (const EnumeratorModelItem &e : enumerators) { QString name; if (enclosing) { name += enclosing->name(); @@ -1645,8 +1645,8 @@ AbstractMetaFunctionList AbstractMetaBuilderPrivate::templateClassFunctionList(c } } - const AbstractMetaFunctionList::ConstIterator unchangedBegin = unchangedFunctions.begin(); - const AbstractMetaFunctionList::ConstIterator unchangedEnd = unchangedFunctions.end(); + const AbstractMetaFunctionList::ConstIterator unchangedBegin = unchangedFunctions.cbegin(); + const AbstractMetaFunctionList::ConstIterator unchangedEnd = unchangedFunctions.cend(); for (int i = result.size() - 1; i >= 0; --i) { AbstractMetaFunction *function = result.at(i); if (!unchangedFunctions.contains(function) @@ -3034,10 +3034,8 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(AbstractMetaClass *subclass, QString templateParamName; for (const QString &possibleName : qAsConst(possibleNames)) { t = typeDb->findType(possibleName); - if (t) { - QString templateParamName = possibleName; + if (t) break; - } } if (t) { @@ -3185,8 +3183,6 @@ void AbstractMetaBuilderPrivate::parseQ_Property(AbstractMetaClass *metaClass, continue; } - QString typeName = scope + l.at(0); - QPropertySpec* spec = new QPropertySpec(type->typeEntry()); spec->setName(l.at(1)); spec->setIndex(i); -- cgit v1.2.3