diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-21 15:41:58 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-01-21 18:04:29 +0100 |
commit | 948bb445b09870f2100ab61d912e3a2f1769c06e (patch) | |
tree | 260ae9bc5cbd2c476b298447673ab2c54d6bec59 /sources/shiboken6/generator/shiboken/cppgenerator.cpp | |
parent | 123e27090e0ec4f8d32f301700c9ff9d1b49ba2a (diff) |
Clean up some warnings produced by Qt Creator's clang/clazy code checkers
- Remove unused variables
- Remove assignments that do not have any effect
- Fix mixing const/non-const iterators
- Fix for loops, use const ref and/or qAsConst()
Change-Id: I4b52f11030493c440026b194f18ec0151a3ea710
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken6/generator/shiboken/cppgenerator.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 6a2b38f1c..179bfa2d5 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -682,8 +682,6 @@ void CppGenerator::generateClass(TextStream &s, const GeneratorContext &classCon } } - const QString signaturesString = signatureStream.toString(); - if (supportsSequenceProtocol(metaClass)) { writeSequenceMethods(s, metaClass, classContext); } @@ -1053,7 +1051,6 @@ void CppGenerator::writeVirtualMethodNative(TextStream &s, if (func->argumentRemoved(arg.argumentIndex() + 1)) continue; - QString argConv; const auto &argType = arg.type(); auto argTypeEntry = static_cast<const PrimitiveTypeEntry *>(argType.typeEntry()); bool convert = argTypeEntry->isObject() @@ -2277,8 +2274,6 @@ void CppGenerator::writeErrorSection(TextStream &s, OverloadData &overloadData) const auto rfunc = overloadData.referenceFunction(); s << '\n' << cpythonFunctionName(rfunc) << "_TypeError:\n"; Indentation indentation(s); - QString funcName = fullPythonFunctionName(rfunc, true); - QString argsVar = pythonFunctionWrapperUsesListOfArguments(overloadData) ? QLatin1String("args") : QLatin1String(PYTHON_ARG); s << "Shiboken::setErrorAboutWrongArguments(" << argsVar @@ -3354,7 +3349,7 @@ QString CppGenerator::argumentNameFromIndex(const ApiExtractorResult &api, *errorMessage = msgClassNotFound(argType.typeEntry()); if (argIndex == 1 && !func->isConstructor() - && OverloadData::isSingleArgument(getFunctionGroups(func->implementingClass())[func->name()])) + && OverloadData::isSingleArgument(getFunctionGroups(func->implementingClass()).value(func->name()))) pyArgName = QLatin1String(PYTHON_ARG); else pyArgName = pythonArgsAt(argIndex - 1); @@ -4192,12 +4187,8 @@ void CppGenerator::writeClassDefinition(TextStream &s, QLatin1String("Sbk_object_dealloc /* PYSIDE-832: Prevent replacement of \"0\" with subtype_dealloc. */"); tp_init.clear(); } else { - QString deallocClassName = classContext.useWrapper() - ? classContext.wrapperName() : cppClassName; - if (isQApp) - tp_dealloc = QLatin1String("&SbkDeallocQAppWrapper"); - else - tp_dealloc = QLatin1String("&SbkDeallocWrapper"); + tp_dealloc = isQApp + ? QLatin1String("&SbkDeallocQAppWrapper") : QLatin1String("&SbkDeallocWrapper"); if (!onlyPrivCtor && !ctors.isEmpty()) tp_init = cpythonFunctionName(ctors.constFirst()); } @@ -6397,7 +6388,6 @@ void CppGenerator::writeDefaultSequenceMethods(TextStream &s, writeCppSelfDefinition(s, context); writeIndexError(s, QLatin1String("index out of bounds")); - QString value; s << metaClass->qualifiedCppName() << "::const_iterator _item = " << CPP_SELF_VAR << "->begin();\n" << "std::advance(_item, _i);\n"; |