diff options
33 files changed, 184 insertions, 184 deletions
diff --git a/sources/pyside6/libpyside/pyside.cpp b/sources/pyside6/libpyside/pyside.cpp index 4336f4970..4dee1bbd0 100644 --- a/sources/pyside6/libpyside/pyside.cpp +++ b/sources/pyside6/libpyside/pyside.cpp @@ -850,7 +850,7 @@ bool registerInternalQtConf() rccData.append('\n'); // The RCC data structure expects a 4-byte size value representing the actual data. - int size = rccData.size(); + qsizetype size = rccData.size(); for (int i = 0; i < 4; ++i) { rccData.prepend((size & 0xff)); diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp index 4266e13f4..0695cf99f 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp @@ -436,12 +436,12 @@ FileModelItem AbstractMetaBuilderPrivate::buildDom(QByteArrayList arguments, clangFlags, builder) ? builder.dom() : FileModelItem(); const clang::BaseVisitor::Diagnostics &diagnostics = builder.diagnostics(); - if (const int diagnosticsCount = diagnostics.size()) { + if (const auto diagnosticsCount = diagnostics.size()) { QDebug d = qWarning(); d.nospace(); d.noquote(); d << "Clang: " << diagnosticsCount << " diagnostic messages:\n"; - for (int i = 0; i < diagnosticsCount; ++i) + for (qsizetype i = 0; i < diagnosticsCount; ++i) d << " " << diagnostics.at(i) << '\n'; } return result; @@ -1082,7 +1082,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem TypeEntries template_args; template_args.clear(); auto argumentParent = metaClass->typeEntry()->typeSystemTypeEntry(); - for (int i = 0; i < template_parameters.size(); ++i) { + for (qsizetype i = 0; i < template_parameters.size(); ++i) { const TemplateParameterModelItem ¶m = template_parameters.at(i); auto param_type = new TemplateArgumentEntry(param->name(), type->version(), argumentParent); @@ -1428,12 +1428,12 @@ void AbstractMetaBuilderPrivate::fillAddedFunctions(AbstractMetaClass *metaClass QString AbstractMetaBuilder::getSnakeCaseName(const QString &name) { - const int size = name.size(); + const auto size = name.size(); if (size < 3) return name; QString result; result.reserve(size + 4); - for (int i = 0; i < size; ++i) { + for (qsizetype i = 0; i < size; ++i) { const QChar c = name.at(i); if (c.isUpper()) { if (i > 0) { @@ -1695,7 +1695,7 @@ AbstractMetaFunction * // Find the correct default values const FunctionModificationList functionMods = metaFunction->modifications(metaClass); - for (int i = 0; i < metaArguments.size(); ++i) { + for (qsizetype i = 0; i < metaArguments.size(); ++i) { AbstractMetaArgument &metaArg = metaArguments[i]; // use replace-default-expression for set default value @@ -1750,7 +1750,7 @@ void AbstractMetaBuilderPrivate::fixArgumentNames(AbstractMetaFunction *func, co } } - for (int i = 0, size = arguments.size(); i < size; ++i) { + for (qsizetype i = 0, size = arguments.size(); i < size; ++i) { if (arguments.at(i).name().isEmpty()) arguments[i].setName(u"arg__"_s + QString::number(i + 1), false); } @@ -2039,7 +2039,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio arguments.pop_front(); } - for (int i = 0; i < arguments.size(); ++i) { + for (qsizetype i = 0; i < arguments.size(); ++i) { const ArgumentModelItem &arg = arguments.at(i); if (TypeDatabase::instance()->isArgumentTypeRejected(className, arg->type().toString(), &rejectReason)) { @@ -2103,7 +2103,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio } // Find the correct default values - for (int i = 0, size = metaArguments.size(); i < size; ++i) { + for (qsizetype i = 0, size = metaArguments.size(); i < size; ++i) { const ArgumentModelItem &arg = arguments.at(i); AbstractMetaArgument &metaArg = metaArguments[i]; @@ -2504,7 +2504,7 @@ std::optional<AbstractMetaType> // the global scope when they are referenced from inside a namespace. // This is a work around to fix this bug since fixing it in resolveType // seemed non-trivial - int i = d ? d->m_scopes.size() - 1 : -1; + qsizetype i = d ? d->m_scopes.size() - 1 : -1; while (i >= 0) { typeInfo = TypeInfo::resolveType(_typei, d->m_scopes.at(i--)); if (typeInfo.qualifiedName().join(colonColon()) != _typei.qualifiedName().join(colonColon())) @@ -2561,7 +2561,7 @@ std::optional<AbstractMetaType> return {}; } - for (int i = typeInfo.arrayElements().size() - 1; i >= 0; --i) { + for (auto i = typeInfo.arrayElements().size() - 1; i >= 0; --i) { AbstractMetaType arrayType; arrayType.setArrayElementType(elementType.value()); const QString &arrayElement = typeInfo.arrayElements().at(i); @@ -2621,7 +2621,7 @@ std::optional<AbstractMetaType> metaType.setOriginalTypeDescription(_typei.toString()); const auto &templateArguments = typeInfo.instantiations(); - for (int t = 0, size = templateArguments.size(); t < size; ++t) { + for (qsizetype t = 0, size = templateArguments.size(); t < size; ++t) { const TypeInfo &ti = templateArguments.at(t); auto targType = translateTypeStatic(ti, currentClass, d, flags, &errorMessage); // For non-type template parameters, create a dummy type entry on the fly @@ -2906,7 +2906,7 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::findTemplateClass(const QString & QStringList scope = context->typeEntry()->qualifiedCppName().split(colonColon()); QString errorMessage; scope.removeLast(); - for (int i = scope.size(); i >= 0; --i) { + for (auto i = scope.size(); i >= 0; --i) { QString prefix = i > 0 ? QStringList(scope.mid(0, i)).join(colonColon()) + colonColon() : QString(); QString completeName = prefix + name; const TypeInfo parsed = TypeParser::parse(completeName, &errorMessage); @@ -3145,9 +3145,9 @@ AbstractMetaFunctionPtr } ComplexTypeEntry *te = subclass->typeEntry(); - FunctionModificationList mods = function->modifications(templateClass); - for (int i = 0; i < mods.size(); ++i) { - FunctionModification mod = mods.at(i); + const FunctionModificationList mods = function->modifications(templateClass); + + for (auto mod : mods) { mod.setSignature(f->minimalSignature()); // If we ever need it... Below is the code to do @@ -3538,7 +3538,7 @@ static bool matchHeader(const QString &headerPath, const QString &fileName) #else static const Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive; #endif - const int pathSize = headerPath.size(); + const auto pathSize = headerPath.size(); return fileName.size() > pathSize && isFileSystemSlash(fileName.at(pathSize)) && fileName.startsWith(headerPath, caseSensitivity); @@ -3592,9 +3592,9 @@ void AbstractMetaBuilder::formatDebug(QDebug &debug) const debug << "m_globalHeader=" << d->m_globalHeaders; debugFormatSequence(debug, "globalEnums", d->m_globalEnums, "\n"); debugFormatSequence(debug, "globalFunctions", d->m_globalFunctions, "\n"); - if (const int scopeCount = d->m_scopes.size()) { + if (const auto scopeCount = d->m_scopes.size()) { debug << "\n scopes[" << scopeCount << "]=("; - for (int i = 0; i < scopeCount; ++i) { + for (qsizetype i = 0; i < scopeCount; ++i) { if (i) debug << ", "; _CodeModelItem::formatKind(debug, d->m_scopes.at(i)->kind()); diff --git a/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp b/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp index ce43c63cd..87ec88311 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp @@ -315,7 +315,7 @@ static void formatMetaEnum(QDebug &d, const AbstractMetaEnum &e) d << " (unsigned) "; d << '['; const AbstractMetaEnumValueList &values = e.values(); - for (int i = 0, count = values.size(); i < count; ++i) { + for (qsizetype i = 0, count = values.size(); i < count; ++i) { if (i) d << ", "; formatMetaEnumValue(d, values.at(i)); diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp index 888c6339a..7ad39edec 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp @@ -360,10 +360,10 @@ AbstractMetaFunction::CompareResult AbstractMetaFunction::compareTo(const Abstra maxArguments = arguments(); } - int minCount = minArguments.size(); - int maxCount = maxArguments.size(); + const auto minCount = minArguments.size(); + const auto maxCount = maxArguments.size(); bool same = true; - for (int i = 0; i < maxCount; ++i) { + for (qsizetype i = 0; i < maxCount; ++i) { if (i < minCount) { const AbstractMetaArgument &min_arg = minArguments.at(i); const AbstractMetaArgument &max_arg = maxArguments.at(i); @@ -556,7 +556,7 @@ bool AbstractMetaFunction::isUserDeclared() const int AbstractMetaFunction::actualMinimumArgumentCount() const { int count = 0; - for (int i = 0, size = d->m_arguments.size(); i < size; ++i && ++count) { + for (qsizetype i = 0, size = d->m_arguments.size(); i < size; ++i && ++count) { const auto &arg = d->m_arguments.at(i); if (arg.isModifiedRemoved()) --count; @@ -1579,7 +1579,7 @@ void AbstractMetaFunction::formatDebugVerbose(QDebug &debug) const if (d->m_exceptionHandlingModification != TypeSystem::ExceptionHandling::Unspecified) debug << " exeption-mod " << int(d->m_exceptionHandlingModification); debug << '('; - for (int i = 0, count = d->m_arguments.size(); i < count; ++i) { + for (qsizetype i = 0, count = d->m_arguments.size(); i < count; ++i) { if (i) debug << ", "; debug << d->m_arguments.at(i); diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp index 2c7eb897d..f315e8418 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp @@ -645,7 +645,7 @@ bool AbstractMetaClass::hasHashFunction() const AbstractMetaClass::PropertyFunctionSearchResult AbstractMetaClass::searchPropertyFunction(const QString &name) const { - for (int i = 0, size = d->m_propertySpecs.size(); i < size; ++i) { + for (qsizetype i = 0, size = d->m_propertySpecs.size(); i < size; ++i) { const auto &propertySpec = d->m_propertySpecs.at(i); if (name == propertySpec.read()) return PropertyFunctionSearchResult{i, PropertyFunction::Read}; @@ -1838,8 +1838,8 @@ void AbstractMetaClass::format(QDebug &debug) const if (debug.verbosity() > 2) debug << static_cast<const void *>(this) << ", "; debug << '"' << qualifiedCppName(); - if (const int count = d->m_templateArgs.size()) { - for (int i = 0; i < count; ++i) + if (const auto count = d->m_templateArgs.size()) { + for (qsizetype i = 0; i < count; ++i) debug << (i ? ',' : '<') << d->m_templateArgs.at(i)->qualifiedCppName(); debug << '>'; } @@ -1883,13 +1883,13 @@ void AbstractMetaClass::format(QDebug &debug) const if (auto templateBase = templateBaseClass()) { const auto &instantiatedTypes = templateBaseClassInstantiations(); debug << ", instantiates \"" << templateBase->name(); - for (int i = 0, count = instantiatedTypes.size(); i < count; ++i) + for (qsizetype i = 0, count = instantiatedTypes.size(); i < count; ++i) debug << (i ? ',' : '<') << instantiatedTypes.at(i).name(); debug << ">\""; } - if (const int count = d->m_propertySpecs.size()) { + if (const auto count = d->m_propertySpecs.size()) { debug << ", properties (" << count << "): ["; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { if (i) debug << ", "; d->m_propertySpecs.at(i).formatDebug(debug); @@ -1903,18 +1903,18 @@ void AbstractMetaClass::formatMembers(QDebug &debug) const if (!d->m_enums.isEmpty()) debug << ", enums[" << d->m_enums.size() << "]=" << d->m_enums; if (!d->m_functions.isEmpty()) { - const int count = d->m_functions.size(); + const auto count = d->m_functions.size(); debug << ", functions=[" << count << "]("; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { if (i) debug << ", "; d->m_functions.at(i)->formatDebugBrief(debug); } debug << ')'; } - if (const int count = d->m_fields.size()) { + if (const auto count = d->m_fields.size()) { debug << ", fields=[" << count << "]("; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { if (i) debug << ", "; d->m_fields.at(i).formatDebug(debug); diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.h b/sources/shiboken6/ApiExtractor/abstractmetalang.h index 6dc2cdfd6..45268faac 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetalang.h +++ b/sources/shiboken6/ApiExtractor/abstractmetalang.h @@ -270,7 +270,7 @@ public: }; struct PropertyFunctionSearchResult { - int index; + qsizetype index; PropertyFunction function; }; diff --git a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp index a7ee6aa31..e260429ff 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp @@ -563,7 +563,7 @@ QString AbstractMetaTypeData::formatSignature(bool minimal) const result += u'<'; if (minimal) result += u' '; - for (int i = 0, size = m_instantiations.size(); i < size; ++i) { + for (qsizetype i = 0, size = m_instantiations.size(); i < size; ++i) { if (i > 0) result += u','; result += m_instantiations.at(i).minimalSignature(); @@ -631,7 +631,7 @@ QString AbstractMetaTypeData::formatPythonSignature() const } if (!m_instantiations.isEmpty()) { result += u'['; - for (int i = 0, size = m_instantiations.size(); i < size; ++i) { + for (qsizetype i = 0, size = m_instantiations.size(); i < size; ++i) { if (i > 0) result += u", "_s; result += m_instantiations.at(i).formatPythonSignature(); @@ -1018,9 +1018,9 @@ void AbstractMetaType::formatDebug(QDebug &debug) const << "\", arrayElementCount=" << arrayElementCount(); } const auto &instantiations = this->instantiations(); - if (const int instantiationsSize = instantiations.size()) { + if (const auto instantiationsSize = instantiations.size()) { debug << ", instantiations[" << instantiationsSize << "]=<"; - for (int i = 0; i < instantiationsSize; ++i) { + for (qsizetype i = 0; i < instantiationsSize; ++i) { if (i) debug << ", "; instantiations.at(i).formatDebug(debug); diff --git a/sources/shiboken6/ApiExtractor/addedfunction.cpp b/sources/shiboken6/ApiExtractor/addedfunction.cpp index 208587551..6525c1ed7 100644 --- a/sources/shiboken6/ApiExtractor/addedfunction.cpp +++ b/sources/shiboken6/ApiExtractor/addedfunction.cpp @@ -37,11 +37,11 @@ QDebug operator<<(QDebug d, const Argument &a) // Helper for finding the end of a function parameter, observing // nested template parameters or lists. -static int parameterTokenEnd(int startPos, QStringView paramString) +static qsizetype parameterTokenEnd(qsizetype startPos, QStringView paramString) { - const int end = paramString.size(); + const auto end = paramString.size(); int nestingLevel = 0; - for (int p = startPos; p < end; ++p) { + for (qsizetype p = startPos; p < end; ++p) { switch (paramString.at(p).toLatin1()) { case ',': if (nestingLevel == 0) @@ -69,9 +69,9 @@ static int parameterTokenEnd(int startPos, QStringView paramString) static QList<QStringView> splitParameterTokens(QStringView paramString) { QList<QStringView> result; - int startPos = 0; + qsizetype startPos = 0; for ( ; startPos < paramString.size(); ) { - int end = parameterTokenEnd(startPos, paramString); + const auto end = parameterTokenEnd(startPos, paramString); result.append(paramString.mid(startPos, end - startPos).trimmed()); startPos = end + 1; } diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp index 1973d3d38..78874577e 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp @@ -48,7 +48,7 @@ static inline bool withinClassDeclaration(const CXCursor &cursor) static QString fixTypeName(QString t) { // Fix "Foo &" -> "Foo&", similarly "Bar **" -> "Bar**" - int pos = t.size() - 1; + auto pos = t.size() - 1; for (; pos >= 0 && (t.at(pos) == u'&' || t.at(pos) == u'*'); --pos) {} if (pos > 0 && t.at(pos) == u' ') t.remove(pos, 1); @@ -63,7 +63,7 @@ static bool insertTemplateParameterIntoClassName(const QString &parmName, QStrin if (Q_UNLIKELY(!name->endsWith(u'>'))) return false; const bool needsComma = name->at(name->size() - 2) != u'<'; - const int insertionPos = name->size() - 1; + const auto insertionPos = name->size() - 1; name->insert(insertionPos, parmName); if (needsComma) name->insert(insertionPos, u','); @@ -502,7 +502,7 @@ void BuilderPrivate::addTemplateInstantiations(const CXType &type, && !t->instantiations().isEmpty(); if (!parsed) t->setInstantiations({}); - const QPair<int, int> pos = parsed + const auto pos = parsed ? parseTemplateArgumentList(*typeName, dummyTemplateArgumentHandler) : t->parseTemplateArgumentList(*typeName); if (pos.first != -1 && pos.second != -1 && pos.second > pos.first) @@ -614,7 +614,7 @@ void BuilderPrivate::addTypeDef(const CXCursor &cursor, const CXType &cxType) ClassModelItem BuilderPrivate::currentTemplateClass() const { - for (int i = m_scopeStack.size() - 1; i >= 0; --i) { + for (auto i = m_scopeStack.size() - 1; i >= 0; --i) { auto klass = qSharedPointerDynamicCast<_ClassModelItem>(m_scopeStack.at(i)); if (!klass.isNull() && klass->isTemplate()) return klass; @@ -1046,7 +1046,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor) // operators). Note: CXTranslationUnit_SkipFunctionBodies must be off for // clang_isCursorDefinition() to work here. if (!d->m_withinFriendDecl || clang_isCursorDefinition(cursor) != 0) { - int scope = d->m_scopeStack.size() - 1; // enclosing class + auto scope = d->m_scopeStack.size() - 1; // enclosing class if (d->m_withinFriendDecl) { // Friend declaration: go back to namespace or file scope. for (--scope; d->m_scopeStack.at(scope)->kind() == _CodeModelItem::Kind_Class; --scope) { diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp index ca5fafd2a..9762b352f 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/clangparser.cpp @@ -213,9 +213,9 @@ static QByteArray msgCreateTranslationUnit(const QByteArrayList &clangArgs, unsi { QByteArray result = "clang_parseTranslationUnit2(0x"; result += QByteArray::number(flags, 16); - const int count = clangArgs.size(); + const auto count = clangArgs.size(); result += ", cmd[" + QByteArray::number(count) + "]="; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { const QByteArray &arg = clangArgs.at(i); if (i) result += ' '; diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp index 3d5b04fd2..6955e4ec2 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp +++ b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp @@ -166,16 +166,17 @@ QList<Diagnostic> getDiagnostics(CXTranslationUnit tu) return result; } -QPair<int, int> parseTemplateArgumentList(const QString &l, - const TemplateArgumentHandler &handler, - int from) +QPair<qsizetype, qsizetype> + parseTemplateArgumentList(const QString &l, + const TemplateArgumentHandler &handler, + qsizetype from) { - const int ltPos = l.indexOf(u'<', from); + const auto ltPos = l.indexOf(u'<', from); if (ltPos == - 1) return qMakePair(-1, -1); - int startPos = ltPos + 1; + auto startPos = ltPos + 1; int level = 1; - for (int p = startPos, end = l.size(); p < end; ) { + for (qsizetype p = startPos, end = l.size(); p < end; ) { const char c = l.at(p).toLatin1(); switch (c) { case ',': @@ -256,9 +257,9 @@ QDebug operator<<(QDebug s, const Diagnostic &d) if (d.source != Diagnostic::Clang) s << " [other]"; - if (const int childMessagesCount = d.childMessages.size()) { + if (const auto childMessagesCount = d.childMessages.size()) { s << '\n'; - for (int i = 0; i < childMessagesCount; ++i) + for (qsizetype i = 0; i < childMessagesCount; ++i) s << " " << d.childMessages.at(i) << '\n'; } diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangutils.h b/sources/shiboken6/ApiExtractor/clangparser/clangutils.h index c1d6be446..9ad0cbc57 100644 --- a/sources/shiboken6/ApiExtractor/clangparser/clangutils.h +++ b/sources/shiboken6/ApiExtractor/clangparser/clangutils.h @@ -89,9 +89,10 @@ CXDiagnosticSeverity maxSeverity(const QList<Diagnostic> &ds); // with each match (level and string). Return begin and end of the list. using TemplateArgumentHandler = std::function<void (int, QStringView)>; -QPair<int, int> parseTemplateArgumentList(const QString &l, - const TemplateArgumentHandler &handler, - int from = 0); +QPair<qsizetype, qsizetype> + parseTemplateArgumentList(const QString &l, + const TemplateArgumentHandler &handler, + qsizetype from = 0); #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug, const SourceLocation &); diff --git a/sources/shiboken6/ApiExtractor/docparser.cpp b/sources/shiboken6/ApiExtractor/docparser.cpp index 4745e675d..91eb2bd6b 100644 --- a/sources/shiboken6/ApiExtractor/docparser.cpp +++ b/sources/shiboken6/ApiExtractor/docparser.cpp @@ -106,7 +106,7 @@ DocModificationList DocParser::getDocModifications(const AbstractMetaClass* cppC AbstractMetaFunctionCList DocParser::documentableFunctions(const AbstractMetaClass *metaClass) { auto result = metaClass->functionsInTargetLang(); - for (int i = result.size() - 1; i >= 0; --i) { + for (auto i = result.size() - 1; i >= 0; --i) { if (DocParser::skipForQuery(result.at(i)) || result.at(i)->isUserAdded()) result.removeAt(i); } diff --git a/sources/shiboken6/ApiExtractor/messages.cpp b/sources/shiboken6/ApiExtractor/messages.cpp index 4e9f5ad9a..5fbd6c8aa 100644 --- a/sources/shiboken6/ApiExtractor/messages.cpp +++ b/sources/shiboken6/ApiExtractor/messages.cpp @@ -49,8 +49,8 @@ QString msgNoFunctionForModification(const AbstractMetaClass *klass, str << " " << s << '\n'; } else if (!allFunctions.isEmpty()) { str << "\n No candidates were found. Member functions:\n"; - const int maxCount = qMin(10, allFunctions.size()); - for (int f = 0; f < maxCount; ++f) + const auto maxCount = qMin(qsizetype(10), allFunctions.size()); + for (qsizetype f = 0; f < maxCount; ++f) str << " " << allFunctions.at(f)->minimalSignature() << '\n'; if (maxCount < allFunctions.size()) str << " ...\n"; @@ -723,9 +723,9 @@ QString msgCyclicDependency(const QString &funcName, const QString &graphName, << "\". Cyclic functions:"; for (const auto &c : cyclic) str << ' ' << c->signature(); - if (const int count = involvedConversions.size()) { + if (const auto count = involvedConversions.size()) { str << " Implicit conversions (" << count << "): "; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { if (i) str << ", \""; str << involvedConversions.at(i)->signature() << '"'; diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp index 5cc8b00f4..d42cfb460 100644 --- a/sources/shiboken6/ApiExtractor/modifications.cpp +++ b/sources/shiboken6/ApiExtractor/modifications.cpp @@ -192,7 +192,7 @@ QDebug operator<<(QDebug d, const CodeSnip &s) d << '"'; const QString &code = f.code(); const auto lines = QStringView{code}.split(u'\n'); - for (int i = 0, size = lines.size(); i < size; ++i) { + for (qsizetype i = 0, size = lines.size(); i < size; ++i) { if (i) d << "\\n"; d << lines.at(i).trimmed(); diff --git a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp index 42df4e482..e9388c9c8 100644 --- a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp +++ b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp @@ -413,9 +413,9 @@ template <class List> static void formatModelItemList(QDebug &d, const char *prefix, const List &l, const char *separator = ", ") { - if (const int size = l.size()) { + if (const auto size = l.size()) { d << prefix << '[' << size << "]("; - for (int i = 0; i < size; ++i) { + for (qsizetype i = 0; i < size; ++i) { if (i) d << separator; l.at(i)->formatDebug(d); @@ -432,7 +432,7 @@ void _ClassModelItem::formatDebug(QDebug &d) const d << " [final]"; d << ", inherits="; d << ", inherits="; - for (int i = 0, size = m_baseClasses.size(); i < size; ++i) { + for (qsizetype i = 0, size = m_baseClasses.size(); i < size; ++i) { if (i) d << ", "; d << m_baseClasses.at(i).name << " (" << m_baseClasses.at(i).accessPolicy << ')'; @@ -556,7 +556,7 @@ template class LIBSAMPLE_EXPORT Tpl<54>; */ void _ScopeModelItem::purgeClassDeclarations() { - for (int i = m_classes.size() - 1; i >= 0; --i) { + for (auto i = m_classes.size() - 1; i >= 0; --i) { auto klass = m_classes.at(i); // For an empty class, check if there is a matching template // definition, and remove it if this is the case. @@ -1063,7 +1063,7 @@ QString _FunctionModelItem::typeSystemSignature() const // For dumping out type QString result; QTextStream str(&result); str << name() << '('; - for (int a = 0, size = m_arguments.size(); a < size; ++a) { + for (qsizetype a = 0, size = m_arguments.size(); a < size; ++a) { if (a) str << ','; m_arguments.at(a)->type().formatTypeSystemSignature(str); @@ -1254,7 +1254,7 @@ void _TemplateTypeAliasModelItem::formatDebug(QDebug &d) const { _CodeModelItem::formatDebug(d); d << ", <"; - for (int i = 0, count = m_templateParameters.size(); i < count; ++i) { + for (qsizetype i = 0, count = m_templateParameters.size(); i < count; ++i) { if (i) d << ", "; d << m_templateParameters.at(i)->name(); diff --git a/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp b/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp index 2dff569cb..205f01de8 100644 --- a/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp +++ b/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp @@ -309,9 +309,9 @@ TypeInfo TypeInfo::resolveType(CodeModelItem __item, TypeInfo const &__type, con // other="QList<int>", replace the instantiations to obtain "QVector<int>". auto aliasInstantiations = templateTypeAlias->type().instantiations(); const auto &concreteInstantiations = otherType.instantiations(); - const int count = qMin(aliasInstantiations.size(), concreteInstantiations.size()); - for (int i = 0; i < count; ++i) - aliasInstantiations[i] = concreteInstantiations[i]; + const auto count = qMin(aliasInstantiations.size(), concreteInstantiations.size()); + for (qsizetype i = 0; i < count; ++i) + aliasInstantiations[i] = concreteInstantiations.at(i); combined.setInstantiations(aliasInstantiations); const CodeModelItem nextItem = __scope->model()->findItem(combined.qualifiedName(), __scope); if (!nextItem) @@ -361,7 +361,7 @@ private: QStack<TypeInfo *> m_parseStack; }; -QPair<int, int> TypeInfo::parseTemplateArgumentList(const QString &l, int from) +QPair<qsizetype, qsizetype> TypeInfo::parseTemplateArgumentList(const QString &l, qsizetype from) { return clang::parseTemplateArgumentList(l, clang::TemplateArgumentHandler(TypeInfoTemplateArgumentHandler(this)), from); } @@ -377,9 +377,9 @@ QString TypeInfo::toString() const tmp += d->m_qualifiedName.join(u"::"_s); - if (const int instantiationCount = d->m_instantiations.size()) { + if (const auto instantiationCount = d->m_instantiations.size()) { tmp += u'<'; - for (int i = 0; i < instantiationCount; ++i) { + for (qsizetype i = 0; i < instantiationCount; ++i) { if (i) tmp += u", "_s; tmp += d->m_instantiations.at(i).toString(); @@ -468,7 +468,7 @@ bool TypeInfo::stripLeadingVolatile(QString *s) bool TypeInfo::stripLeadingQualifier(const QString &qualifier, QString *s) { // "const int x" - const int qualifierSize = qualifier.size(); + const auto qualifierSize = qualifier.size(); if (s->size() < qualifierSize + 1 || !s->startsWith(qualifier) || !s->at(qualifierSize).isSpace()) { return false; @@ -514,7 +514,7 @@ void TypeInfoData::simplifyStdType() Q_ASSERT(isStdType()); if (m_qualifiedName.at(1).startsWith(u"__")) m_qualifiedName.removeAt(1); - for (int t = m_instantiations.size() - 1; t >= 0; --t) { + for (auto t = m_instantiations.size() - 1; t >= 0; --t) { if (m_instantiations.at(t).isStdType()) { if (discardStdType(m_instantiations.at(t).qualifiedName().constLast())) m_instantiations.removeAt(t); diff --git a/sources/shiboken6/ApiExtractor/parser/typeinfo.h b/sources/shiboken6/ApiExtractor/parser/typeinfo.h index e015647fa..cf3576eb6 100644 --- a/sources/shiboken6/ApiExtractor/parser/typeinfo.h +++ b/sources/shiboken6/ApiExtractor/parser/typeinfo.h @@ -79,7 +79,7 @@ public: bool isStdType() const; - QPair<int, int> parseTemplateArgumentList(const QString &l, int from = 0); + QPair<qsizetype, qsizetype> parseTemplateArgumentList(const QString &l, qsizetype from = 0); bool equals(const TypeInfo &other) const; diff --git a/sources/shiboken6/ApiExtractor/propertyspec.cpp b/sources/shiboken6/ApiExtractor/propertyspec.cpp index c9eca3fad..6882c8a79 100644 --- a/sources/shiboken6/ApiExtractor/propertyspec.cpp +++ b/sources/shiboken6/ApiExtractor/propertyspec.cpp @@ -192,13 +192,13 @@ TypeSystemProperty QPropertySpec::typeSystemPropertyFromQ_Property(const QString return result; } - const int firstToken = int(it - propertyTokens.cbegin()); + const auto firstToken = qsizetype(it - propertyTokens.cbegin()); if (firstToken < 2) { *errorMessage = u"Insufficient number of tokens in property specification"_s; return result; } - for (int pos = firstToken; pos + 1 < propertyTokens.size(); pos += 2) { + for (qsizetype pos = firstToken; pos + 1 < propertyTokens.size(); pos += 2) { switch (tokenLookup.value(propertyTokens.at(pos))) { case PropertyToken::Read: result.read = propertyTokens.at(pos + 1); @@ -254,7 +254,7 @@ std::optional<QPropertySpec> auto type = b->translateType(info, metaClass, {}, &typeError); if (!type.has_value()) { const QStringList qualifiedName = info.qualifiedName(); - for (int j = scopes.size(); j >= 0 && !type; --j) { + for (auto j = scopes.size(); j >= 0 && !type; --j) { info.setQualifiedName(scopes.mid(0, j) + qualifiedName); type = b->translateType(info, metaClass, {}, &typeError); } diff --git a/sources/shiboken6/ApiExtractor/qtdocparser.cpp b/sources/shiboken6/ApiExtractor/qtdocparser.cpp index 1be0235db..3829c3463 100644 --- a/sources/shiboken6/ApiExtractor/qtdocparser.cpp +++ b/sources/shiboken6/ApiExtractor/qtdocparser.cpp @@ -74,7 +74,7 @@ static void formatFunctionUnqualifiedArgTypeQuery(QTextStream &str, case AbstractMetaType::ContainerPattern: { // QVector<int> str << metaType.typeEntry()->qualifiedCppName() << '<'; const auto instantiations = metaType.instantiations(); - for (int i = 0, size = instantiations.size(); i < size; ++i) { + for (qsizetype i = 0, size = instantiations.size(); i < size; ++i) { if (i) str << ", "; const auto &instantiation = instantiations.at(i); diff --git a/sources/shiboken6/ApiExtractor/reporthandler.cpp b/sources/shiboken6/ApiExtractor/reporthandler.cpp index a6cc50911..2fc7b47b7 100644 --- a/sources/shiboken6/ApiExtractor/reporthandler.cpp +++ b/sources/shiboken6/ApiExtractor/reporthandler.cpp @@ -122,7 +122,7 @@ void ReportHandler::messageOutput(QtMsgType type, const QMessageLogContext &cont QString message = m_prefix; if (!message.isEmpty()) message.append(u' '); - const int prefixLength = message.size(); + const auto prefixLength = message.size(); message.append(text); // Replace file location tab by space if (fileLocationPos >= 0) diff --git a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp index 3f687186e..0a75c4e6d 100644 --- a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp +++ b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp @@ -85,7 +85,7 @@ void TestRemoveOperatorMethod::testRemoveOperatorMethod() removedSignatures.append(u"operator>>(double&)"_s); removedSignatures.append(u"operator>>(Char&)"_s); removedSignatures.append(u"operator>>(String&)"_s); - int notRemoved = classA->functions().size(); + auto notRemoved = classA->functions().size(); for (const auto &f : classA->functions()) { QCOMPARE(f->isModifiedRemoved(), bool(removedSignatures.contains(f->minimalSignature()))); notRemoved -= int(f->isModifiedRemoved()); diff --git a/sources/shiboken6/ApiExtractor/typedatabase.cpp b/sources/shiboken6/ApiExtractor/typedatabase.cpp index 8a0ee1b65..65817337b 100644 --- a/sources/shiboken6/ApiExtractor/typedatabase.cpp +++ b/sources/shiboken6/ApiExtractor/typedatabase.cpp @@ -779,9 +779,9 @@ bool TypeDatabase::addSuppressedWarning(const QString &warning, QString *errorMe pattern = warning; } else { // Legacy syntax: Use wildcards '*' (unless escaped by '\') - QList<int> asteriskPositions; - const int warningSize = warning.size(); - for (int i = 0; i < warningSize; ++i) { + QList<qsizetype> asteriskPositions; + const auto warningSize = warning.size(); + for (qsizetype i = 0, warningSize = warning.size(); i < warningSize; ++i) { if (warning.at(i) == u'\\') ++i; else if (warning.at(i) == u'*') @@ -790,11 +790,11 @@ bool TypeDatabase::addSuppressedWarning(const QString &warning, QString *errorMe asteriskPositions.append(warningSize); pattern.append(u'^'); - int lastPos = 0; - for (int a = 0, aSize = asteriskPositions.size(); a < aSize; ++a) { + qsizetype lastPos = 0; + for (qsizetype a = 0, aSize = asteriskPositions.size(); a < aSize; ++a) { if (a) pattern.append(QStringLiteral(".*")); - const int nextPos = asteriskPositions.at(a); + const auto nextPos = asteriskPositions.at(a); if (nextPos > lastPos) pattern.append(QRegularExpression::escape(warning.mid(lastPos, nextPos - lastPos))); lastPos = nextPos + 1; @@ -1003,9 +1003,9 @@ static QStringList splitTypeList(const QString &s) { QStringList result; int templateDepth = 0; - int lastPos = 0; - const int size = s.size(); - for (int i = 0; i < size; ++i) { + qsizetype lastPos = 0; + const auto size = s.size(); + for (qsizetype i = 0; i < size; ++i) { switch (s.at(i).toLatin1()) { case '<': ++templateDepth; @@ -1205,7 +1205,7 @@ bool TypeDatabase::setApiVersion(const QString& packageWildcardPattern, const QS if (versionNumber.isNull()) return false; ApiVersions &versions = *apiVersions(); - for (int i = 0, size = versions.size(); i < size; ++i) { + for (qsizetype i = 0, size = versions.size(); i < size; ++i) { if (versions.at(i).first.pattern() == packagePattern) { versions[i].second = versionNumber; return true; @@ -1224,7 +1224,7 @@ bool TypeDatabase::checkApiVersion(const QString &package, const ApiVersions &versions = *apiVersions(); if (versions.isEmpty()) // Nothing specified: use latest. return true; - for (int i = 0, size = versions.size(); i < size; ++i) { + for (qsizetype i = 0, size = versions.size(); i < size; ++i) { if (versions.at(i).first.match(package).hasMatch()) return versions.at(i).second >= vr.since && versions.at(i).second <= vr.until; @@ -1242,9 +1242,9 @@ bool TypeDatabase::hasDroppedTypeEntries() const template <class Container, class Separator> static void formatList(QDebug &d, const char *name, const Container &c, Separator sep) { - if (const int size = c.size()) { + if (const auto size = c.size()) { d << ", " << name << '[' << size << "]=("; - for (int i = 0; i < size; ++i) { + for (qsizetype i = 0; i < size; ++i) { if (i) d << sep; d << c.at(i); diff --git a/sources/shiboken6/ApiExtractor/typesystem.cpp b/sources/shiboken6/ApiExtractor/typesystem.cpp index 36f411a09..9974a887c 100644 --- a/sources/shiboken6/ApiExtractor/typesystem.cpp +++ b/sources/shiboken6/ApiExtractor/typesystem.cpp @@ -331,7 +331,7 @@ QString TypeEntryPrivate::shortName() const } if (foundInlineNamespace) { m_cachedShortName.reserve(m_name.size()); - for (int i = parents.size() - 1; i >= 0; --i) { + for (auto i = parents.size() - 1; i >= 0; --i) { m_cachedShortName.append(parents.at(i)->entryName()); m_cachedShortName.append(u"::"_s); } @@ -2299,9 +2299,9 @@ ObjectTypeEntry::ObjectTypeEntry(ComplexTypeEntryPrivate *d) : template <class Container, class Separator> static void formatList(QDebug &d, const char *name, const Container &c, Separator sep) { - if (const int size = c.size()) { + if (const auto size = c.size()) { d << ", " << name << '[' << size << "]=("; - for (int i = 0; i < size; ++i) { + for (qsizetype i = 0; i < size; ++i) { if (i) d << sep; d << c.at(i); diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp index b333febc8..17ed97b0d 100644 --- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp +++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp @@ -535,7 +535,7 @@ ENUM_LOOKUP_LINEAR_SEARCH() static int indexOfAttribute(const QXmlStreamAttributes &atts, QStringView name) { - for (int i = 0, size = atts.size(); i < size; ++i) { + for (qsizetype i = 0, size = atts.size(); i < size; ++i) { if (atts.at(i).qualifiedName() == name) return i; } @@ -566,7 +566,7 @@ static QString msgUnusedAttributes(QStringView tag, const QXmlStreamAttributes & QString result; QTextStream str(&result); str << attributes.size() << " attributes(s) unused on <" << tag << ">: "; - for (int i = 0, size = attributes.size(); i < size; ++i) { + for (qsizetype i = 0, size = attributes.size(); i < size; ++i) { if (i) str << ", "; str << attributes.at(i); @@ -611,7 +611,7 @@ QString TypeSystemEntityResolver::readFile(const QString &entityName, QString *e QString result = QString::fromUtf8(file.readAll()).trimmed(); // Remove license header comments on which QXmlStreamReader chokes if (result.startsWith(u"<!--")) { - const int commentEnd = result.indexOf(u"-->"); + const auto commentEnd = result.indexOf(u"-->"); if (commentEnd != -1) { result.remove(0, commentEnd + 3); result = result.trimmed(); @@ -734,7 +734,7 @@ static inline static bool addRejection(TypeDatabase *database, QXmlStreamAttributes *attributes, QString *errorMessage) { - const int classIndex = indexOfAttribute(*attributes, classAttribute()); + const auto classIndex = indexOfAttribute(*attributes, classAttribute()); if (classIndex == -1) { *errorMessage = msgMissingAttribute(classAttribute()); return false; @@ -745,7 +745,7 @@ static bool addRejection(TypeDatabase *database, QXmlStreamAttributes *attribute if (!setRejectionRegularExpression(className, &rejection.className, errorMessage)) return false; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto &attribute = attributes->at(i); const auto name = attribute.qualifiedName(); const auto typeOpt = typeRejectionFromAttribute(name); @@ -1276,7 +1276,7 @@ bool TypeSystemParser::applyCommonAttributes(const ConditionalStreamReader &read type->setSourceLocation(SourceLocation(m_currentFile, reader.lineNumber())); type->setCodeGeneration(m_generate); - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"revision") { type->setRevision(attributes->takeAt(i).value().toInt()); @@ -1301,7 +1301,7 @@ CustomTypeEntry *TypeSystemParser::parseCustomTypeEntry(const ConditionalStreamR if (!checkRootElement()) return nullptr; auto *result = new CustomTypeEntry(name, since, m_contextStack.top()->entry); - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == checkFunctionAttribute()) result->setCheckFunction(attributes->takeAt(i).value().toString()); @@ -1372,7 +1372,7 @@ SmartPointerTypeEntry * QString nullCheckMethod; QString resetMethod; QString instantiations; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"type") { const auto attribute = attributes->takeAt(i); @@ -1444,7 +1444,7 @@ PrimitiveTypeEntry * QString targetLangApiName; if (!applyCommonAttributes(reader, type, attributes)) return nullptr; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == targetLangNameAttribute()) { type->setTargetLangName(attributes->takeAt(i).value().toString()); @@ -1496,7 +1496,7 @@ ContainerTypeEntry * { if (!checkRootElement()) return nullptr; - const int typeIndex = indexOfAttribute(*attributes, u"type"); + const auto typeIndex = indexOfAttribute(*attributes, u"type"); if (typeIndex == -1) { m_error = u"no 'type' attribute specified"_s; return nullptr; @@ -1514,7 +1514,7 @@ ContainerTypeEntry * return nullptr; applyComplexTypeAttributes(reader, type, attributes); - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"opaque-containers") { const auto attribute = attributes->takeAt(i); @@ -1541,7 +1541,7 @@ EnumTypeEntry * entry->setTargetLangPackage(m_defaultPackage); QString flagNames; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"upper-bound") { qCWarning(lcShiboken, "%s", @@ -1589,7 +1589,7 @@ NamespaceTypeEntry * std::unique_ptr<NamespaceTypeEntry> result(new NamespaceTypeEntry(name, since, currentParentTypeEntry())); auto visibility = TypeSystem::Visibility::Unspecified; applyCommonAttributes(reader, result.get(), attributes); - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto attributeName = attributes->at(i).qualifiedName(); if (attributeName == u"files") { const QString pattern = attributes->takeAt(i).value().toString(); @@ -1670,7 +1670,7 @@ FunctionTypeEntry * QString signature; TypeSystem::SnakeCase snakeCase = TypeSystem::SnakeCase::Disabled; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == signatureAttribute()) { signature = TypeDatabase::normalizedSignature(attributes->takeAt(i).value().toString()); @@ -1723,7 +1723,7 @@ TypedefEntry * m_error = u"typedef entries must be nested in namespaces or type system."_s; return nullptr; } - const int sourceIndex = indexOfAttribute(*attributes, sourceAttribute()); + const auto sourceIndex = indexOfAttribute(*attributes, sourceAttribute()); if (sourceIndex == -1) { m_error = msgMissingAttribute(sourceAttribute()); return nullptr; @@ -1746,7 +1746,7 @@ void TypeSystemParser::applyComplexTypeAttributes(const ConditionalStreamReader auto allowThread = m_allowThread; QString package = m_defaultPackage; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == streamAttribute()) { ctype->setStream(convertBoolean(attributes->takeAt(i).value(), streamAttribute(), false)); @@ -1883,7 +1883,7 @@ bool TypeSystemParser::parseRenameFunction(const ConditionalStreamReader &, { QString signature; QString rename; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == signatureAttribute()) { // Do not remove as it is needed for the type entry later on @@ -1940,7 +1940,7 @@ bool TypeSystemParser::parseInjectDocumentation(const ConditionalStreamReader &, TypeSystem::DocModificationMode mode = TypeSystem::DocModificationReplace; TypeSystem::Language lang = TypeSystem::NativeCode; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"mode") { const auto attribute = attributes->takeAt(i); @@ -1985,7 +1985,7 @@ bool TypeSystemParser::parseModifyDocumentation(const ConditionalStreamReader &, return false; } - const int xpathIndex = indexOfAttribute(*attributes, xPathAttribute()); + const auto xpathIndex = indexOfAttribute(*attributes, xPathAttribute()); if (xpathIndex == -1) { m_error = msgMissingAttribute(xPathAttribute()); return false; @@ -2005,7 +2005,7 @@ TypeSystemTypeEntry *TypeSystemParser::parseRootElement(const ConditionalStreamR { TypeSystem::SnakeCase snakeCase = TypeSystem::SnakeCase::Unspecified; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == packageAttribute()) { m_defaultPackage = attributes->takeAt(i).value().toString(); @@ -2072,7 +2072,7 @@ bool TypeSystemParser::loadTypesystem(const ConditionalStreamReader &, { QString typeSystemName; bool generateChild = true; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == nameAttribute()) typeSystemName = attributes->takeAt(i).value().toString(); @@ -2098,7 +2098,7 @@ bool TypeSystemParser::parseRejectEnumValue(const ConditionalStreamReader &, m_error = u"<reject-enum-value> node must be used inside a <enum-type> node"_s; return false; } - const int nameIndex = indexOfAttribute(*attributes, nameAttribute()); + const auto nameIndex = indexOfAttribute(*attributes, nameAttribute()); if (nameIndex == -1) { m_error = msgMissingAttribute(nameAttribute()); return false; @@ -2115,7 +2115,7 @@ bool TypeSystemParser::parseReplaceArgumentType(const ConditionalStreamReader &, m_error = u"Type replacement can only be specified for argument modifications"_s; return false; } - const int modifiedTypeIndex = indexOfAttribute(*attributes, modifiedTypeAttribute()); + const auto modifiedTypeIndex = indexOfAttribute(*attributes, modifiedTypeAttribute()); if (modifiedTypeIndex == -1) { m_error = u"Type replacement requires 'modified-type' attribute"_s; return false; @@ -2141,7 +2141,7 @@ bool TypeSystemParser::parseCustomConversion(const ConditionalStreamReader &, QString sourceFile; QString snippetLabel; TypeSystem::Language lang = TypeSystem::NativeCode; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == classAttribute()) { const auto languageAttribute = attributes->takeAt(i); @@ -2246,7 +2246,7 @@ bool TypeSystemParser::parseAddConversion(const ConditionalStreamReader &, if (parserState() == ParserState::ArgumentTargetToNativeConversion) return true; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"type") sourceTypeName = attributes->takeAt(i).value().toString(); @@ -2305,7 +2305,7 @@ bool TypeSystemParser::parseModifyArgument(const ConditionalStreamReader &, QString renameTo; QString pyiType; bool resetAfterUse = false; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == indexAttribute()) { index = attributes->takeAt(i).value().toString(); @@ -2368,7 +2368,7 @@ bool TypeSystemParser::parseDefineOwnership(const ConditionalStreamReader &, TypeSystem::Language lang = TypeSystem::TargetLangCode; std::optional<TypeSystem::Ownership> ownershipOpt; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == classAttribute()) { const auto classAttribute = attributes->takeAt(i); @@ -2416,7 +2416,7 @@ bool TypeSystemParser::parseRename(const ConditionalStreamReader &, return false; } - const int toIndex = indexOfAttribute(*attributes, toAttribute()); + const auto toIndex = indexOfAttribute(*attributes, toAttribute()); if (toIndex == -1) { m_error = msgMissingAttribute(toAttribute()); return false; @@ -2430,7 +2430,7 @@ bool TypeSystemParser::parseModifyField(const ConditionalStreamReader &, QXmlStreamAttributes *attributes) { FieldModification fm; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == nameAttribute()) { fm.setName(attributes->takeAt(i).value().toString()); @@ -2495,7 +2495,7 @@ bool TypeSystemParser::parseAddFunction(const ConditionalStreamReader &, bool classMethod = false; QString access; int overloadNumber = TypeSystem::OverloadNumberUnset; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"signature") { originalSignature = attributes->takeAt(i).value().toString(); @@ -2576,7 +2576,7 @@ bool TypeSystemParser::parseAddPyMethodDef(const ConditionalStreamReader &, } TypeSystemPyMethodDefEntry def; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == nameAttribute()) { def.name = attributes->takeAt(i).value().toString(); @@ -2615,7 +2615,7 @@ bool TypeSystemParser::parseProperty(const ConditionalStreamReader &, StackEleme } TypeSystemProperty property; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == nameAttribute()) { property.name = attributes->takeAt(i).value().toString(); @@ -2662,7 +2662,7 @@ bool TypeSystemParser::parseModifyFunction(const ConditionalStreamReader &reader TypeSystem::ExceptionHandling exceptionHandling = TypeSystem::ExceptionHandling::Unspecified; TypeSystem::AllowThread allowThread = TypeSystem::AllowThread::Unspecified; TypeSystem::SnakeCase snakeCase = TypeSystem::SnakeCase::Unspecified; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"signature") { originalSignature = attributes->takeAt(i).value().toString(); @@ -2782,7 +2782,7 @@ bool TypeSystemParser::parseReplaceDefaultExpression(const ConditionalStreamRead m_error = u"Replace default expression only allowed as child of argument modification"_s; return false; } - const int withIndex = indexOfAttribute(*attributes, u"with"); + const auto withIndex = indexOfAttribute(*attributes, u"with"); if (withIndex == -1 || attributes->at(withIndex).value().isEmpty()) { m_error = u"Default expression replaced with empty string. Use remove-default-expression instead."_s; return false; @@ -2803,7 +2803,7 @@ bool TypeSystemParser::parseReferenceCount(const ConditionalStreamReader &reader } ReferenceCount rc; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == actionAttribute()) { const QXmlStreamAttribute attribute = attributes->takeAt(i); @@ -2840,7 +2840,7 @@ bool TypeSystemParser::parseParentOwner(const ConditionalStreamReader &, return false; } ArgumentOwner ao; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == indexAttribute()) { const QString index = attributes->takeAt(i).value().toString(); @@ -2864,7 +2864,7 @@ bool TypeSystemParser::readFileSnippet(QXmlStreamAttributes *attributes, CodeSni { QString fileName; QString snippetLabel; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"file") { fileName = attributes->takeAt(i).value().toString(); @@ -2923,7 +2923,7 @@ bool TypeSystemParser::parseInjectCode(const ConditionalStreamReader &, CodeSnip snip; if (!readFileSnippet(attributes, &snip)) return false; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == classAttribute()) { const auto attribute = attributes->takeAt(i); @@ -2972,7 +2972,7 @@ bool TypeSystemParser::parseInclude(const ConditionalStreamReader &, { QString fileName; Include::IncludeType location = Include::IncludePath; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == fileNameAttribute()) { fileName = attributes->takeAt(i).value().toString(); @@ -3006,7 +3006,7 @@ bool TypeSystemParser::parseInclude(const ConditionalStreamReader &, bool TypeSystemParser::parseSystemInclude(const ConditionalStreamReader &, QXmlStreamAttributes *attributes) { - const int index = indexOfAttribute(*attributes, fileNameAttribute()); + const auto index = indexOfAttribute(*attributes, fileNameAttribute()); if (index == -1) { m_error = msgMissingAttribute(fileNameAttribute()); return false; @@ -3029,7 +3029,7 @@ TemplateInstance * "conversion-rule, native-to-target or add-conversion tags."_s; return nullptr; } - const int nameIndex = indexOfAttribute(*attributes, nameAttribute()); + const auto nameIndex = indexOfAttribute(*attributes, nameAttribute()); if (nameIndex == -1) { m_error = msgMissingAttribute(nameAttribute()); return nullptr; @@ -3046,7 +3046,7 @@ bool TypeSystemParser::parseReplace(const ConditionalStreamReader &, } QString from; QString to; - for (int i = attributes->size() - 1; i >= 0; --i) { + for (auto i = attributes->size() - 1; i >= 0; --i) { const auto name = attributes->at(i).qualifiedName(); if (name == u"from") from = attributes->takeAt(i).value().toString(); @@ -3104,7 +3104,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack QXmlStreamAttributes attributes = reader.attributes(); VersionRange versionRange; - for (int i = attributes.size() - 1; i >= 0; --i) { + for (auto i = attributes.size() - 1; i >= 0; --i) { const auto name = attributes.at(i).qualifiedName(); if (name == sinceAttribute()) { if (!parseVersion(attributes.takeAt(i).value().toString(), @@ -3158,7 +3158,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack if (isTypeEntry(element)) { QString name; if (element != StackElement::FunctionTypeEntry) { - const int nameIndex = indexOfAttribute(attributes, nameAttribute()); + const auto nameIndex = indexOfAttribute(attributes, nameAttribute()); if (nameIndex != -1) { name = attributes.takeAt(nameIndex).value().toString(); } else if (element != StackElement::EnumTypeEntry) { // anonymous enum? @@ -3206,7 +3206,8 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack } if (element == StackElement::EnumTypeEntry) { - const int enumIdentifiedByIndex = indexOfAttribute(attributes, enumIdentifiedByValueAttribute()); + const auto enumIdentifiedByIndex = + indexOfAttribute(attributes, enumIdentifiedByValueAttribute()); const QString identifiedByValue = enumIdentifiedByIndex != -1 ? attributes.takeAt(enumIdentifiedByIndex).value().toString() : QString(); if (name.isEmpty()) { @@ -3352,7 +3353,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack const auto topParent = m_stack.value(m_stack.size() - 3, StackElement::None); if (isTypeEntry(topParent)) { - const int replaceIndex = indexOfAttribute(attributes, replaceAttribute()); + const auto replaceIndex = indexOfAttribute(attributes, replaceAttribute()); const bool replace = replaceIndex == -1 || convertBoolean(attributes.takeAt(replaceIndex).value(), replaceAttribute(), true); @@ -3382,7 +3383,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack return false; break; case StackElement::SuppressedWarning: { - const int textIndex = indexOfAttribute(attributes, textAttribute()); + const auto textIndex = indexOfAttribute(attributes, textAttribute()); if (textIndex == -1) { qCWarning(lcShiboken) << "Suppressed warning with no text specified"; } else { @@ -3466,7 +3467,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack return false; break; case StackElement::Template: { - const int nameIndex = indexOfAttribute(attributes, nameAttribute()); + const auto nameIndex = indexOfAttribute(attributes, nameAttribute()); if (nameIndex == -1) { m_error = msgMissingAttribute(nameAttribute()); return false; diff --git a/sources/shiboken6/generator/generator.cpp b/sources/shiboken6/generator/generator.cpp index 6cfcf6c86..b95161c36 100644 --- a/sources/shiboken6/generator/generator.cpp +++ b/sources/shiboken6/generator/generator.cpp @@ -486,7 +486,7 @@ std::optional<DefaultValue> // Examine arguments, exclude functions taking a self parameter bool simple = true; bool suitable = true; - for (int i = 0, size = arguments.size(); + for (qsizetype i = 0, size = arguments.size(); suitable && i < size && !arguments.at(i).hasOriginalDefaultValueExpression(); ++i) { const AbstractMetaArgument &arg = arguments.at(i); const TypeEntry *aType = arg.type().typeEntry(); @@ -501,7 +501,7 @@ std::optional<DefaultValue> for (auto it = candidates.cbegin(), end = candidates.cend(); it != end; ++it) { const AbstractMetaArgumentList &arguments = it.value()->arguments(); QStringList args; - for (int i = 0, size = arguments.size(); i < size; ++i) { + for (qsizetype i = 0, size = arguments.size(); i < size; ++i) { const AbstractMetaArgument &arg = arguments.at(i); if (arg.hasModifiedDefaultValueExpression()) { args << arg.defaultValueExpression(); // Spell out modified values diff --git a/sources/shiboken6/generator/main.cpp b/sources/shiboken6/generator/main.cpp index bdc7aaf96..5c9d9320c 100644 --- a/sources/shiboken6/generator/main.cpp +++ b/sources/shiboken6/generator/main.cpp @@ -298,7 +298,7 @@ static void getCommandLineArgs(CommandLineArguments &args) { const QStringList arguments = QCoreApplication::arguments(); int argNum = 0; - for (int i = 1, size = arguments.size(); i < size; ++i) + for (qsizetype i = 1, size = arguments.size(); i < size; ++i) getCommandLineArg(arguments.at(i).trimmed(), argNum, args); } diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp index 1d291eb87..c0b2c37b8 100644 --- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp @@ -359,7 +359,7 @@ void QtDocGenerator::writeConstructors(TextStream& s, const AbstractMetaClass* c auto lst = cppClass->queryFunctions(FunctionQueryOption::AnyConstructor | FunctionQueryOption::Visible); - for (int i = lst.size() - 1; i >= 0; --i) { + for (auto i = lst.size() - 1; i >= 0; --i) { if (lst.at(i)->isModifiedRemoved() || lst.at(i)->functionType() == AbstractMetaFunction::MoveConstructorFunction) lst.removeAt(i); } @@ -474,8 +474,8 @@ void QtDocGenerator::writeDocSnips(TextStream &s, QString code = snip.code(); while (code.contains(startMarkup) && code.contains(endMarkup)) { - int startBlock = code.indexOf(startMarkup) + startMarkup.size(); - int endBlock = code.indexOf(endMarkup); + const auto startBlock = code.indexOf(startMarkup) + startMarkup.size(); + const auto endBlock = code.indexOf(endMarkup); if ((startBlock == -1) || (endBlock == -1)) break; @@ -483,7 +483,7 @@ void QtDocGenerator::writeDocSnips(TextStream &s, QString codeBlock = code.mid(startBlock, endBlock - startBlock); const QStringList rows = codeBlock.split(u'\n'); int currentRow = 0; - int offset = 0; + qsizetype offset = 0; for (QString row : rows) { for (const QString &invalidString : std::as_const(invalidStrings)) diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index c431a0c74..495183644 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -3927,7 +3927,7 @@ void CppGenerator::writeMethodCall(TextStream &s, const AbstractMetaFunctionCPtr QStringList otherArgs; bool otherArgsModified = false; bool argsClear = true; - for (int i = func->arguments().size() - 1; i >= maxArgs + removedArgs; i--) { + for (auto i = func->arguments().size() - 1; i >= maxArgs + removedArgs; i--) { const AbstractMetaArgument &arg = func->arguments().at(i); const bool defValModified = arg.hasModifiedDefaultValueExpression(); const bool hasConversionRule = @@ -4287,7 +4287,7 @@ void CppGenerator::writeMultipleInheritanceInitializerFunction(TextStream &s, co QString className = metaClass->qualifiedCppName(); const QStringList ancestors = getAncestorMultipleInheritance(metaClass); s << "static int mi_offsets[] = { "; - for (int i = 0; i < ancestors.size(); i++) + for (qsizetype i = 0; i < ancestors.size(); i++) s << "-1, "; s << "-1 };\n" << "int *\n" @@ -5926,7 +5926,7 @@ void CppGenerator::writeClassRegister(TextStream &s, if (metaClass->baseClassNames().size() > 1) { s << "PyObject *" << pyTypeBasesVariable << " = PyTuple_Pack(" << baseClasses.size() << ',' << '\n' << indent; - for (int i = 0, size = baseClasses.size(); i < size; ++i) { + for (qsizetype i = 0, size = baseClasses.size(); i < size; ++i) { if (i) s << ",\n"; s << "reinterpret_cast<PyObject *>(" diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp index d5f60d2dd..a0a5c5696 100644 --- a/sources/shiboken6/generator/shiboken/headergenerator.cpp +++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp @@ -400,11 +400,11 @@ static void formatTypeDefEntries(TextStream &s) const QString name = e->qualifiedCppName(); // Fixme: simplify by using nested namespaces in C++ 17. const auto components = QStringView{name}.split(u"::"); - const int nameSpaceCount = components.size() - 1; - for (int n = 0; n < nameSpaceCount; ++n) + const auto nameSpaceCount = components.size() - 1; + for (qsizetype n = 0; n < nameSpaceCount; ++n) s << "namespace " << components.at(n) << " {\n"; s << "using " << components.constLast() << " = " << e->sourceType() << ";\n"; - for (int n = 0; n < nameSpaceCount; ++n) + for (qsizetype n = 0; n < nameSpaceCount; ++n) s << "}\n"; } s << '\n'; diff --git a/sources/shiboken6/generator/shiboken/overloaddata.cpp b/sources/shiboken6/generator/shiboken/overloaddata.cpp index 7cd4e9dd4..6bcadd83a 100644 --- a/sources/shiboken6/generator/shiboken/overloaddata.cpp +++ b/sources/shiboken6/generator/shiboken/overloaddata.cpp @@ -55,7 +55,7 @@ static bool typesAreEqual(const AbstractMetaType &typeA, const AbstractMetaType if (typeA.instantiations().size() != typeB.instantiations().size()) return false; - for (int i = 0; i < typeA.instantiations().size(); ++i) { + for (qsizetype i = 0; i < typeA.instantiations().size(); ++i) { if (!typesAreEqual(typeA.instantiations().at(i), typeB.instantiations().at(i))) return false; } @@ -641,10 +641,10 @@ bool OverloadDataRootNode::isFinalOccurrence(const AbstractMetaFunctionCPtr &fun AbstractMetaFunctionCPtr OverloadDataRootNode::getFunctionWithDefaultValue() const { - const int argpos = argPos(); + const qsizetype argpos = argPos(); for (const auto &func : m_overloads) { - int removedArgs = 0; - for (int i = 0; i <= argpos + removedArgs; i++) { + qsizetype removedArgs = 0; + for (qsizetype i = 0; i <= argpos + removedArgs; i++) { if (func->arguments().at(i).isModifiedRemoved()) removedArgs++; } @@ -661,7 +661,7 @@ QList<int> OverloadData::invalidArgumentLengths() const for (const auto &func : m_overloads) { const AbstractMetaArgumentList args = func->arguments(); int offset = 0; - for (int i = 0; i < args.size(); ++i) { + for (qsizetype i = 0; i < args.size(); ++i) { if (func->arguments().at(i).isModifiedRemoved()) { offset++; } else { @@ -691,8 +691,8 @@ int OverloadData::numberOfRemovedArguments(const AbstractMetaFunctionCPtr &func, { Q_ASSERT(finalArgPos >= 0); int removed = 0; - const int size = func->arguments().size(); - for (int i = 0; i < qMin(size, finalArgPos + removed); ++i) { + const auto size = func->arguments().size(); + for (qsizetype i = 0; i < qMin(size, qsizetype(finalArgPos + removed)); ++i) { if (func->arguments().at(i).isModifiedRemoved()) ++removed; } @@ -935,7 +935,7 @@ void OverloadDataRootNode::formatOverloads(QDebug &d) const if (count < 2) return; d << "=("; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { if (i) d << '\n'; d << m_overloads.at(i)->signature(); @@ -949,7 +949,7 @@ void OverloadDataRootNode::formatNextOverloadData(QDebug &d) const d << ", next[" << count << ']'; if (d.verbosity() >= 3) { d << "=("; - for (int i = 0; i < count; ++i) { + for (qsizetype i = 0; i < count; ++i) { if (i) d << '\n'; m_children.at(i)->formatDebug(d); diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp index 3da888373..e768dcc1a 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp @@ -1052,11 +1052,8 @@ void ShibokenGenerator::writeFunctionArguments(TextStream &s, const AbstractMetaFunctionCPtr &func, Options options) const { - AbstractMetaArgumentList arguments = func->arguments(); - int argUsed = 0; - for (int i = 0; i < arguments.size(); ++i) { - const auto &arg = arguments.at(i); + for (const auto &arg : func->arguments()) { if (options.testFlag(Generator::SkipRemovedArguments) && arg.isModifiedRemoved()) continue; @@ -1264,7 +1261,7 @@ ShibokenGenerator::ArgumentVarReplacementList TypeSystem::Language convLang = (language == TypeSystem::TargetLangCode) ? TypeSystem::NativeCode : TypeSystem::TargetLangCode; int removed = 0; - for (int i = 0; i < func->arguments().size(); ++i) { + for (qsizetype i = 0; i < func->arguments().size(); ++i) { const AbstractMetaArgument &arg = func->arguments().at(i); QString argValue; if (language == TypeSystem::TargetLangCode) { diff --git a/sources/shiboken6/tests/dumpcodemodel/main.cpp b/sources/shiboken6/tests/dumpcodemodel/main.cpp index f04179ca8..1befca260 100644 --- a/sources/shiboken6/tests/dumpcodemodel/main.cpp +++ b/sources/shiboken6/tests/dumpcodemodel/main.cpp @@ -124,7 +124,7 @@ static void startXmlNamespace(QXmlStreamWriter &writer, const NamespaceModelItem static void formatXmlNamespaceMembers(QXmlStreamWriter &writer, const NamespaceModelItem &nsp) { auto nestedNamespaces = nsp->namespaces(); - for (int i = nestedNamespaces.size() - 1; i >= 0; --i) { + for (auto i = nestedNamespaces.size() - 1; i >= 0; --i) { if (!hasMembers(nestedNamespaces.at(i))) nestedNamespaces.removeAt(i); } @@ -135,7 +135,7 @@ static void formatXmlNamespaceMembers(QXmlStreamWriter &writer, const NamespaceM if (optJoinNamespaces) { // Write out members of identical namespaces and remove const QString name = current->name(); - for (int i = 0; i < nestedNamespaces.size(); ) { + for (qsizetype i = 0; i < nestedNamespaces.size(); ) { if (nestedNamespaces.at(i)->name() == name) { formatXmlNamespaceMembers(writer, nestedNamespaces.at(i)); nestedNamespaces.removeAt(i); |