aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-25 09:51:39 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-25 10:44:01 +0200
commite5595a4b3010b1bb4b6f80a0339271a7b26934de (patch)
tree332a63307284ad7957c3daa9e8cb7ba6daed158f
parentddfbbd346b522703a5b6f8d274a7f79983e5f319 (diff)
shiboken: Introduce auto
Apply Fixits by Qt Creator with some amendments. Change-Id: Ib2be1012ef7e8a2ad0e6cd130371bf1e941c4264 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp36
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp18
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testutil.h2
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp4
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp29
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp4
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp4
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp2
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp18
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp18
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp16
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp8
-rw-r--r--sources/shiboken2/libshiboken/sbkarrayconverter.cpp18
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.cpp6
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp12
-rw-r--r--sources/shiboken2/libshiboken/sbkmodule.cpp8
-rw-r--r--sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp14
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp10
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp24
21 files changed, 127 insertions, 128 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index b1c3b911..90664ef3 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -883,7 +883,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
return nullptr;
}
- AbstractMetaEnum *metaEnum = new AbstractMetaEnum;
+ auto *metaEnum = new AbstractMetaEnum;
metaEnum->setEnumKind(enumItem->enumKind());
metaEnum->setSigned(enumItem->isSigned());
if (enumsDeclarations.contains(qualifiedName)
@@ -891,7 +891,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
metaEnum->setHasQEnumsDeclaration(true);
}
- EnumTypeEntry *enumTypeEntry = static_cast<EnumTypeEntry *>(typeEntry);
+ auto *enumTypeEntry = static_cast<EnumTypeEntry *>(typeEntry);
metaEnum->setTypeEntry(enumTypeEntry);
switch (enumItem->accessPolicy()) {
case CodeModel::Public:
@@ -914,7 +914,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
const EnumeratorList &enums = enumItem->enumerators();
for (const EnumeratorModelItem &value : enums) {
- AbstractMetaEnumValue *metaEnumValue = new AbstractMetaEnumValue;
+ auto *metaEnumValue = new AbstractMetaEnumValue;
metaEnumValue->setName(value->name());
// Deciding the enum value...
@@ -993,7 +993,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelIt
if (!type)
return nullptr;
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeDef(true);
metaClass->setTypeEntry(type);
metaClass->setBaseClassNames(QStringList(typeDef->type().toString()));
@@ -1014,7 +1014,7 @@ void AbstractMetaBuilderPrivate::traverseTypesystemTypedefs()
const auto &entries = TypeDatabase::instance()->typedefEntries();
for (auto it = entries.begin(), end = entries.end(); it != end; ++it) {
TypedefEntry *te = it.value();
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeDef(true);
metaClass->setTypeEntry(te->target());
metaClass->setBaseClassNames(QStringList(te->sourceType()));
@@ -1056,7 +1056,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
return nullptr;
}
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeEntry(type);
if (classItem->isFinal())
@@ -1198,7 +1198,7 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(const VariableModel
}
- AbstractMetaField *metaField = new AbstractMetaField;
+ auto *metaField = new AbstractMetaField;
metaField->setName(fieldName);
metaField->setEnclosingClass(cls);
@@ -1282,7 +1282,7 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
if (!retType)
return;
- AbstractMetaType *metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(retType);
metaFunction->replaceType(metaType);
}
@@ -1610,7 +1610,7 @@ AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFu
AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFunctionPtr &addedFunc,
AbstractMetaClass *metaClass)
{
- AbstractMetaFunction *metaFunction = new AbstractMetaFunction(addedFunc);
+ auto *metaFunction = new AbstractMetaFunction(addedFunc);
metaFunction->setType(translateType(addedFunc->returnType()));
@@ -1619,7 +1619,7 @@ AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFu
for (int i = 0; i < args.count(); ++i) {
const AddedFunction::TypeInfo& typeInfo = args.at(i).typeInfo;
- AbstractMetaArgument *metaArg = new AbstractMetaArgument;
+ auto *metaArg = new AbstractMetaArgument;
AbstractMetaType *type = translateType(typeInfo);
if (Q_UNLIKELY(!type)) {
qCWarning(lcShiboken,
@@ -1842,7 +1842,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
}
- AbstractMetaFunction *metaFunction = new AbstractMetaFunction;
+ auto *metaFunction = new AbstractMetaFunction;
if (deprecated)
*metaFunction += AbstractMetaAttributes::Deprecated;
@@ -1968,7 +1968,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
}
- AbstractMetaArgument *metaArgument = new AbstractMetaArgument;
+ auto *metaArgument = new AbstractMetaArgument;
metaArgument->setType(metaType);
metaArgument->setName(arg->name());
@@ -2115,7 +2115,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
qFatal("%s", qPrintable(msg));
}
- AbstractMetaType *metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(type);
metaType->setIndirections(typeInfo.indirections);
if (typeInfo.isReference)
@@ -2229,7 +2229,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
}
for (int i = typeInfo.arrayElements().size() - 1; i >= 0; --i) {
- AbstractMetaType *arrayType = new AbstractMetaType;
+ auto *arrayType = new AbstractMetaType;
arrayType->setArrayElementType(elementType);
const QString &arrayElement = typeInfo.arrayElements().at(i);
if (!arrayElement.isEmpty()) {
@@ -2319,7 +2319,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
// These are only implicit and should not appear in code...
Q_ASSERT(!type->isInterface());
- AbstractMetaType *metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(type);
metaType->setIndirectionsV(typeInfo.indirectionsV());
metaType->setReferenceType(typeInfo.referenceType());
@@ -2601,7 +2601,7 @@ AbstractMetaType *
returned->setOriginalTemplateType(metaType);
if (returned->typeEntry()->isTemplateArgument()) {
- const TemplateArgumentEntry* tae = static_cast<const TemplateArgumentEntry*>(returned->typeEntry());
+ const auto *tae = static_cast<const TemplateArgumentEntry*>(returned->typeEntry());
// If the template is intantiated with void we special case this as rejecting the functions that use this
// parameter from the instantiation.
@@ -2683,7 +2683,7 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(AbstractMetaClass *subclass,
}
if (t) {
- AbstractMetaType *temporaryType = new AbstractMetaType;
+ auto *temporaryType = new AbstractMetaType;
temporaryType->setTypeEntry(t);
temporaryType->setConstant(i.isConstant());
temporaryType->setReferenceType(i.referenceType());
@@ -2835,7 +2835,7 @@ void AbstractMetaBuilderPrivate::parseQ_Property(AbstractMetaClass *metaClass,
continue;
}
- QPropertySpec* spec = new QPropertySpec(type->typeEntry());
+ auto *spec = new QPropertySpec(type->typeEntry());
spec->setName(propertyTokens.at(1).toString());
spec->setIndex(i);
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index 8b29c547..acf01cce 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -188,7 +188,7 @@ QString AbstractMetaType::fullName() const
AbstractMetaType *AbstractMetaType::copy() const
{
- AbstractMetaType *cpy = new AbstractMetaType;
+ auto *cpy = new AbstractMetaType;
cpy->setTypeUsagePattern(typeUsagePattern());
cpy->setConstant(isConstant());
@@ -427,7 +427,7 @@ void AbstractMetaArgument::assignMetaArgument(const AbstractMetaArgument &other)
AbstractMetaArgument *AbstractMetaArgument::copy() const
{
- AbstractMetaArgument *copy = new AbstractMetaArgument;
+ auto *copy = new AbstractMetaArgument;
copy->assignMetaArgument(*this);
return copy;
}
@@ -587,7 +587,7 @@ AbstractMetaFunction::CompareResult AbstractMetaFunction::compareTo(const Abstra
AbstractMetaFunction *AbstractMetaFunction::copy() const
{
- AbstractMetaFunction *cpy = new AbstractMetaFunction;
+ auto *cpy = new AbstractMetaFunction;
cpy->assignMetaAttributes(*this);
cpy->setName(name());
cpy->setOriginalName(originalName());
@@ -1406,7 +1406,7 @@ AbstractMetaClass *AbstractMetaClass::extractInterface()
Q_ASSERT(typeEntry()->designatedInterface());
if (!m_extractedInterface) {
- AbstractMetaClass *iface = new AbstractMetaClass;
+ auto *iface = new AbstractMetaClass;
iface->setAttributes(attributes());
iface->setBaseClass(nullptr);
@@ -1782,7 +1782,7 @@ AbstractMetaField::~AbstractMetaField()
AbstractMetaField *AbstractMetaField::copy() const
{
- AbstractMetaField *returned = new AbstractMetaField;
+ auto *returned = new AbstractMetaField;
returned->assignMetaVariable(*this);
returned->assignMetaAttributes(*this);
returned->setEnclosingClass(nullptr);
@@ -1822,7 +1822,7 @@ static QString upCaseFirst(const QString &str)
static AbstractMetaFunction *createXetter(const AbstractMetaField *g, const QString &name,
AbstractMetaAttributes::Attributes type)
{
- AbstractMetaFunction *f = new AbstractMetaFunction;
+ auto *f = new AbstractMetaFunction;
f->setName(name);
f->setOriginalName(name);
@@ -1880,7 +1880,7 @@ const AbstractMetaFunction *AbstractMetaField::setter() const
QLatin1String("set") + upCaseFirst(name()),
AbstractMetaAttributes::SetterFunction);
AbstractMetaArgumentList arguments;
- AbstractMetaArgument *argument = new AbstractMetaArgument;
+ auto *argument = new AbstractMetaArgument;
argument->setType(type()->copy());
argument->setName(name());
arguments.append(argument);
@@ -2000,7 +2000,7 @@ bool AbstractMetaClass::hasPrivateCopyConstructor() const
void AbstractMetaClass::addDefaultConstructor()
{
- AbstractMetaFunction *f = new AbstractMetaFunction;
+ auto *f = new AbstractMetaFunction;
f->setOriginalName(name());
f->setName(name());
f->setOwnerClass(this);
@@ -2265,7 +2265,7 @@ static void addExtraIncludeForType(AbstractMetaClass *metaClass, const AbstractM
Q_ASSERT(metaClass);
const TypeEntry *entry = (type ? type->typeEntry() : nullptr);
if (entry && entry->isComplex()) {
- const ComplexTypeEntry *centry = static_cast<const ComplexTypeEntry *>(entry);
+ const auto *centry = static_cast<const ComplexTypeEntry *>(entry);
ComplexTypeEntry *class_entry = metaClass->typeEntry();
if (class_entry && centry->include().isValid())
class_entry->addExtraInclude(centry->include());
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
index e116f8b8..6303d09e 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
@@ -119,7 +119,7 @@ QString BaseVisitor::getCodeSnippetString(const CXCursor &cursor)
static CXChildVisitResult
visitorCallback(CXCursor cursor, CXCursor /* parent */, CXClientData clientData)
{
- BaseVisitor *bv = reinterpret_cast<BaseVisitor *>(clientData);
+ auto *bv = reinterpret_cast<BaseVisitor *>(clientData);
const CXSourceLocation location = clang_getCursorLocation(cursor);
if (!bv->visitLocation(location))
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.cpp b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
index 72fa6740..2e50470e 100644
--- a/sources/shiboken2/ApiExtractor/qtdocparser.cpp
+++ b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
@@ -54,7 +54,7 @@ static void formatFunctionArgTypeQuery(QTextStream &str, const AbstractMetaArgum
case AbstractMetaType::FlagsPattern: {
// Modify qualified name "QFlags<Qt::AlignmentFlag>" with name "Alignment"
// to "Qt::Alignment" as seen by qdoc.
- const FlagsTypeEntry *flagsEntry = static_cast<const FlagsTypeEntry *>(metaType->typeEntry());
+ const auto *flagsEntry = static_cast<const FlagsTypeEntry *>(metaType->typeEntry());
QString name = flagsEntry->qualifiedCppName();
if (name.endsWith(QLatin1Char('>')) && name.startsWith(QLatin1String("QFlags<"))) {
const int lastColon = name.lastIndexOf(QLatin1Char(':'));
diff --git a/sources/shiboken2/ApiExtractor/tests/testutil.h b/sources/shiboken2/ApiExtractor/tests/testutil.h
index c6ad19d7..c8f446c1 100644
--- a/sources/shiboken2/ApiExtractor/tests/testutil.h
+++ b/sources/shiboken2/ApiExtractor/tests/testutil.h
@@ -69,7 +69,7 @@ namespace TestUtil
arguments.append(QFile::encodeName(tempSource.fileName()));
tempSource.write(cppCode, qint64(strlen(cppCode)));
tempSource.close();
- AbstractMetaBuilder *builder = new AbstractMetaBuilder;
+ auto *builder = new AbstractMetaBuilder;
if (!builder->build(arguments)) {
delete builder;
return Q_NULLPTR;
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index 279be9dc..06667caa 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -351,7 +351,7 @@ TypeEntry *TypeDatabase::resolveTypeDefEntry(TypedefEntry *typedefEntry,
return nullptr;
}
- ComplexTypeEntry *result = static_cast<ComplexTypeEntry *>(source->clone());
+ auto *result = static_cast<ComplexTypeEntry *>(source->clone());
result->useAsTypedef(typedefEntry);
typedefEntry->setSource(source);
typedefEntry->setTarget(result);
@@ -592,7 +592,7 @@ PrimitiveTypeEntry *TypeDatabase::findPrimitiveType(const QString& name) const
const auto entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry->isPrimitive()) {
- PrimitiveTypeEntry *pe = static_cast<PrimitiveTypeEntry *>(entry);
+ auto *pe = static_cast<PrimitiveTypeEntry *>(entry);
if (pe->preferredTargetLangType())
return pe;
}
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index d90e6817..dc303667 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -510,7 +510,7 @@ Handler::~Handler() = default;
static QString readerFileName(const QXmlStreamReader &reader)
{
- const QFile *file = qobject_cast<const QFile *>(reader.device());
+ const auto *file = qobject_cast<const QFile *>(reader.device());
return file != nullptr ? file->fileName() : QString();
}
@@ -728,7 +728,7 @@ bool Handler::endElement(const QStringRef &localName)
case StackElement::ValueTypeEntry:
case StackElement::InterfaceTypeEntry:
case StackElement::NamespaceTypeEntry: {
- ComplexTypeEntry *centry = static_cast<ComplexTypeEntry *>(m_current->entry);
+ auto *centry = static_cast<ComplexTypeEntry *>(m_current->entry);
centry->setAddedFunctions(m_contextStack.top()->addedFunctions);
centry->setFunctionModifications(m_contextStack.top()->functionMods);
centry->setFieldModifications(m_contextStack.top()->fieldMods);
@@ -1148,8 +1148,7 @@ SmartPointerTypeEntry *
return nullptr;
}
- SmartPointerTypeEntry *type =
- new SmartPointerTypeEntry(name, getter, smartPointerType, refCountMethodName, since);
+ auto *type = new SmartPointerTypeEntry(name, getter, smartPointerType, refCountMethodName, since);
applyCommonAttributes(type, attributes);
return type;
}
@@ -1159,7 +1158,7 @@ PrimitiveTypeEntry *
const QString &name, const QVersionNumber &since,
QXmlStreamAttributes *attributes)
{
- PrimitiveTypeEntry *type = new PrimitiveTypeEntry(name, since);
+ auto *type = new PrimitiveTypeEntry(name, since);
applyCommonAttributes(type, attributes);
for (int i = attributes->size() - 1; i >= 0; --i) {
const QStringRef name = attributes->at(i).qualifiedName();
@@ -1203,7 +1202,7 @@ ContainerTypeEntry *
m_error = QLatin1String("there is no container of type ") + typeName.toString();
return nullptr;
}
- ContainerTypeEntry *type = new ContainerTypeEntry(name, containerType, since);
+ auto *type = new ContainerTypeEntry(name, containerType, since);
applyCommonAttributes(type, attributes);
return type;
}
@@ -1220,7 +1219,7 @@ EnumTypeEntry *
scope = fullName.left(sep);
name = fullName.right(fullName.size() - sep - 2);
}
- EnumTypeEntry *entry = new EnumTypeEntry(scope, name, since);
+ auto *entry = new EnumTypeEntry(scope, name, since);
applyCommonAttributes(entry, attributes);
entry->setTargetLangPackage(m_defaultPackage);
@@ -1258,7 +1257,7 @@ ObjectTypeEntry *
const QString &name, const QVersionNumber &since,
QXmlStreamAttributes *attributes)
{
- ObjectTypeEntry *otype = new ObjectTypeEntry(name, since);
+ auto *otype = new ObjectTypeEntry(name, since);
applyCommonAttributes(otype, attributes);
QString targetLangName = name;
bool generate = true;
@@ -1331,7 +1330,7 @@ ValueTypeEntry *
const QString &name, const QVersionNumber &since,
QXmlStreamAttributes *attributes)
{
- ValueTypeEntry *typeEntry = new ValueTypeEntry(name, since);
+ auto *typeEntry = new ValueTypeEntry(name, since);
applyCommonAttributes(typeEntry, attributes);
const int defaultCtIndex =
indexOfAttribute(*attributes, QStringViewLiteral("default-constructor"));
@@ -1356,7 +1355,7 @@ FunctionTypeEntry *
TypeEntry *existingType = m_database->findType(name);
if (!existingType) {
- FunctionTypeEntry *result = new FunctionTypeEntry(name, signature, since);
+ auto *result = new FunctionTypeEntry(name, signature, since);
applyCommonAttributes(result, attributes);
return result;
}
@@ -1367,7 +1366,7 @@ FunctionTypeEntry *
return nullptr;
}
- FunctionTypeEntry *result = reinterpret_cast<FunctionTypeEntry *>(existingType);
+ auto *result = reinterpret_cast<FunctionTypeEntry *>(existingType);
result->addSignature(signature);
return result;
}
@@ -1626,7 +1625,7 @@ TypeSystemTypeEntry *Handler::parseRootElement(const QXmlStreamReader &,
}
}
- TypeSystemTypeEntry *moduleEntry =
+ auto *moduleEntry =
const_cast<TypeSystemTypeEntry *>(m_database->findTypeSystemType(m_defaultPackage));
const bool add = moduleEntry == nullptr;
if (add)
@@ -1768,7 +1767,7 @@ bool Handler::parseCustomConversion(const QXmlStreamReader &,
}
}
- CustomConversion* customConversion = new CustomConversion(m_current->entry);
+ auto *customConversion = new CustomConversion(m_current->entry);
customConversionsForReview.append(customConversion);
return true;
}
@@ -2305,7 +2304,7 @@ CustomFunction *
else if (name == QLatin1String("param-name"))
paramName = attributes->takeAt(i).value().toString();
}
- CustomFunction *func = new CustomFunction(functionName);
+ auto *func = new CustomFunction(functionName);
func->paramName = paramName;
return func;
}
@@ -2604,7 +2603,7 @@ bool Handler::startElement(const QXmlStreamReader &reader)
return true;
}
- StackElement* element = new StackElement(m_current);
+ auto *element = new StackElement(m_current);
element->type = elementType;
if (element->type == StackElement::Root && m_generate == TypeEntry::GenerateAll)
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 8d6c5903..205ca5e9 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -387,7 +387,7 @@ QtXmlToSphinx::QtXmlToSphinx(QtDocGenerator* generator, const QString& doc, cons
void QtXmlToSphinx::pushOutputBuffer()
{
- QString* buffer = new QString();
+ auto *buffer = new QString();
m_buffers << buffer;
m_output.setString(buffer);
}
@@ -981,7 +981,7 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type,
{
ref.replace(QLatin1String("::"), QLatin1String("."));
ref.remove(QLatin1String("()"));
- LinkContext *result = new LinkContext(ref);
+ auto *result = new LinkContext(ref);
if (m_insideBold)
result->flags |= LinkContext::InsideBold;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index a3760692..60ef30d1 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -390,7 +390,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
// Create string literal for smart pointer getter method.
if (classContext.forSmartPointer()) {
- const SmartPointerTypeEntry *typeEntry =
+ const auto *typeEntry =
static_cast<const SmartPointerTypeEntry *>(classContext.preciseType()
->typeEntry());
QString rawGetter = typeEntry->getter();
@@ -509,7 +509,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
else if (!rfunc->isOperatorOverload()) {
if (classContext.forSmartPointer()) {
- const SmartPointerTypeEntry *smartPointerTypeEntry =
+ const auto *smartPointerTypeEntry =
static_cast<const SmartPointerTypeEntry *>(
classContext.preciseType()->typeEntry());
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index 82b2d96d..8a2c5623 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -310,7 +310,7 @@ void HeaderGenerator::writeTypeIndexValueLine(QTextStream &s, const TypeEntry *t
const int typeIndex = typeEntry->sbkIndex();
_writeTypeIndexValueLine(s, getTypeIndexVariableName(typeEntry), typeIndex);
if (typeEntry->isComplex()) {
- const ComplexTypeEntry *cType = static_cast<const ComplexTypeEntry *>(typeEntry);
+ const auto *cType = static_cast<const ComplexTypeEntry *>(typeEntry);
if (cType->baseContainerType()) {
const AbstractMetaClass *metaClass = AbstractMetaClass::findClass(classes(), cType);
if (metaClass->templateBaseClass())
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 69357644..b5f37cc5 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -750,7 +750,7 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction *func,
|| arg->type()->referenceType() == LValueReference) {
result += QLatin1Char(objType);
} else if (arg->type()->isPrimitive()) {
- const PrimitiveTypeEntry *ptype =
+ const auto *ptype =
static_cast<const PrimitiveTypeEntry *>(arg->type()->typeEntry());
if (ptype->basicReferencedTypeEntry())
ptype = ptype->basicReferencedTypeEntry();
@@ -790,7 +790,7 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntry *type)
if (ShibokenGenerator::isWrapperType(type) || type->isNamespace()) { // && type->referenceType() == NoReference) {
baseName = QLatin1String("Sbk_") + type->name();
} else if (type->isPrimitive()) {
- const PrimitiveTypeEntry *ptype = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *ptype = static_cast<const PrimitiveTypeEntry *>(type);
while (ptype->basicReferencedTypeEntry())
ptype = ptype->basicReferencedTypeEntry();
if (ptype->targetLangApiName() == ptype->name())
@@ -802,7 +802,7 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntry *type)
} else if (type->isFlags()) {
baseName = cpythonFlagsName(static_cast<const FlagsTypeEntry *>(type));
} else if (type->isContainer()) {
- const ContainerTypeEntry *ctype = static_cast<const ContainerTypeEntry *>(type);
+ const auto *ctype = static_cast<const ContainerTypeEntry *>(type);
switch (ctype->type()) {
case ContainerTypeEntry::ListContainer:
case ContainerTypeEntry::StringListContainer:
@@ -883,7 +883,7 @@ QString ShibokenGenerator::converterObject(const TypeEntry *type)
}
/* the typedef'd primitive types case */
- const PrimitiveTypeEntry *pte = dynamic_cast<const PrimitiveTypeEntry *>(type);
+ const auto *pte = dynamic_cast<const PrimitiveTypeEntry *>(type);
if (!pte) {
qDebug() << "Warning: the Qt5 primitive type is unknown" << type->qualifiedCppName();
return QString();
@@ -1104,7 +1104,7 @@ bool ShibokenGenerator::isUserPrimitive(const TypeEntry *type)
{
if (!type->isPrimitive())
return false;
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
trueType = trueType->basicReferencedTypeEntry();
return trueType->isPrimitive() && !trueType->isCppPrimitive()
@@ -1124,7 +1124,7 @@ bool ShibokenGenerator::isCppPrimitive(const TypeEntry *type)
return true;
if (!type->isPrimitive())
return false;
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
trueType = trueType->basicReferencedTypeEntry();
return trueType->qualifiedCppName() == QLatin1String("std::string");
@@ -2323,7 +2323,7 @@ AbstractMetaType *ShibokenGenerator::buildAbstractMetaTypeFromTypeEntry(const Ty
typeName.remove(0, 2);
if (m_metaTypeFromStringCache.contains(typeName))
return m_metaTypeFromStringCache.value(typeName);
- AbstractMetaType *metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(typeEntry);
metaType->clearIndirections();
metaType->setReferenceType(NoReference);
@@ -2663,7 +2663,7 @@ QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass *met
QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry *type)
{
if (type->isCppPrimitive()) {
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
type = trueType->basicReferencedTypeEntry();
}
@@ -2763,7 +2763,7 @@ bool ShibokenGenerator::isCppIntegralPrimitive(const TypeEntry *type)
{
if (!type->isCppPrimitive())
return false;
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
trueType = trueType->basicReferencedTypeEntry();
QString typeName = trueType->qualifiedCppName();
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index db7d0ad8..6d7bd0c2 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -207,7 +207,7 @@ PyTypeObject *SbkObjectType_TypeF(void)
static PyObject *SbkObjectGetDict(PyObject *pObj, void *)
{
- SbkObject *obj = reinterpret_cast<SbkObject *>(pObj);
+ auto *obj = reinterpret_cast<SbkObject *>(pObj);
if (!obj->ob_dict)
obj->ob_dict = PyDict_New();
if (!obj->ob_dict)
@@ -223,7 +223,7 @@ static PyGetSetDef SbkObjectGetSetList[] = {
static int SbkObject_traverse(PyObject *self, visitproc visit, void *arg)
{
- SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
//Visit children
Shiboken::ParentInfo *pInfo = sbkSelf->d->parentInfo;
@@ -246,7 +246,7 @@ static int SbkObject_traverse(PyObject *self, visitproc visit, void *arg)
static int SbkObject_clear(PyObject *self)
{
- SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
Shiboken::Object::removeParent(sbkSelf);
@@ -300,7 +300,7 @@ static int mainThreadDeletionHandler(void *)
static void SbkDeallocWrapperCommon(PyObject *pyObj, bool canDelete)
{
- SbkObject *sbkObj = reinterpret_cast<SbkObject *>(pyObj);
+ auto *sbkObj = reinterpret_cast<SbkObject *>(pyObj);
PyTypeObject *pyType = Py_TYPE(pyObj);
// Need to decref the type if this is the dealloc func; if type
@@ -449,8 +449,8 @@ PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *k
}
// The meta type creates a new type when the Python programmer extends a wrapped C++ class.
- newfunc type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
- SbkObjectType *newType = reinterpret_cast<SbkObjectType *>(type_new(metatype, args, kwds));
+ auto type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
+ auto *newType = reinterpret_cast<SbkObjectType *>(type_new(metatype, args, kwds));
if (!newType)
return nullptr;
@@ -842,7 +842,7 @@ introduceWrapperType(PyObject *enclosingObject,
PyObject *heaptype = PyType_FromSpecWithBases(typeSpec, baseTypes);
Py_TYPE(heaptype) = SbkObjectType_TypeF();
Py_INCREF(Py_TYPE(heaptype));
- SbkObjectType *type = reinterpret_cast<SbkObjectType *>(heaptype);
+ auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
if (baseType) {
if (baseTypes) {
for (int i = 0; i < PySequence_Fast_GET_SIZE(baseTypes); ++i)
@@ -862,7 +862,7 @@ introduceWrapperType(PyObject *enclosingObject,
setOriginalName(type, originalName);
setDestructorFunction(type, cppObjDtor);
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
if (wrapperFlags & InnerClass)
return PyDict_SetItemString(enclosingObject, typeName, ob_type) == 0 ? type : nullptr;
@@ -1044,7 +1044,7 @@ void getOwnership(PyObject *pyObj)
void releaseOwnership(SbkObject *self)
{
// skip if the ownership have already moved to c++
- SbkObjectType *selfType = reinterpret_cast<SbkObjectType *>(Py_TYPE(self));
+ auto *selfType = reinterpret_cast<SbkObjectType *>(Py_TYPE(self));
if (!self->d->hasOwnership || Shiboken::Conversions::pythonTypeIsValueType(PepType_SOTP(selfType)->converter))
return;
diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp
index 92451a15..97ffb1cf 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken2/libshiboken/bindingmanager.cpp
@@ -91,7 +91,7 @@ public:
SbkObjectType *identifyType(void **cptr, SbkObjectType *type, SbkObjectType *baseType) const
{
- Edges::const_iterator edgesIt = m_edges.find(type);
+ auto edgesIt = m_edges.find(type);
if (edgesIt != m_edges.end()) {
const NodeList &adjNodes = m_edges.find(type)->second;
for (SbkObjectType *node : adjNodes) {
@@ -154,7 +154,7 @@ bool BindingManager::BindingManagerPrivate::releaseWrapper(void *cptr, SbkObject
// The wrapper argument is checked to ensure that the correct wrapper is released.
// Returns true if the correct wrapper is found and released.
// If wrapper argument is NULL, no such check is performed.
- WrapperMap::iterator iter = wrapperMapper.find(cptr);
+ auto iter = wrapperMapper.find(cptr);
if (iter != wrapperMapper.end() && (wrapper == nullptr || iter->second == wrapper)) {
wrapperMapper.erase(iter);
return true;
@@ -165,7 +165,7 @@ bool BindingManager::BindingManagerPrivate::releaseWrapper(void *cptr, SbkObject
void BindingManager::BindingManagerPrivate::assignWrapper(SbkObject *wrapper, const void *cptr)
{
assert(cptr);
- WrapperMap::iterator iter = wrapperMapper.find(cptr);
+ auto iter = wrapperMapper.find(cptr);
if (iter == wrapperMapper.end())
wrapperMapper.insert(std::make_pair(cptr, wrapper));
}
@@ -238,7 +238,7 @@ void BindingManager::releaseWrapper(SbkObject *sbkObj)
void ** cptrs = reinterpret_cast<SbkObject *>(sbkObj)->d->cptr;
for (int i = 0; i < numBases; ++i) {
- unsigned char *cptr = reinterpret_cast<unsigned char *>(cptrs[i]);
+ auto *cptr = reinterpret_cast<unsigned char *>(cptrs[i]);
m_d->releaseWrapper(cptr, sbkObj);
if (d && d->mi_offsets) {
int *offset = d->mi_offsets;
@@ -266,7 +266,7 @@ void BindingManager::addToDeletionInMainThread(const DestructorEntry &e)
SbkObject *BindingManager::retrieveWrapper(const void *cptr)
{
- WrapperMap::iterator iter = m_d->wrapperMapper.find(cptr);
+ auto iter = m_d->wrapperMapper.find(cptr);
if (iter == m_d->wrapperMapper.end())
return nullptr;
return iter->second;
@@ -299,7 +299,7 @@ PyObject *BindingManager::getOverride(const void *cptr, const char *methodName)
// The first class in the mro (index 0) is the class being checked and it should not be tested.
// The last class in the mro (size - 1) is the base Python object class which should not be tested also.
for (int i = 1; i < PyTuple_GET_SIZE(mro) - 1; i++) {
- PyTypeObject *parent = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, i));
+ auto *parent = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, i));
if (parent->tp_dict) {
defaultMethod = PyDict_GetItem(parent->tp_dict, pyMethodName);
if (defaultMethod && PyMethod_GET_FUNCTION(method) != defaultMethod) {
@@ -335,7 +335,7 @@ std::set<PyObject *> BindingManager::getAllPyObjects()
{
std::set<PyObject *> pyObjects;
const WrapperMap &wrappersMap = m_d->wrapperMapper;
- WrapperMap::const_iterator it = wrappersMap.begin();
+ auto it = wrappersMap.begin();
for (; it != wrappersMap.end(); ++it)
pyObjects.insert(reinterpret_cast<PyObject *>(it->second));
@@ -345,7 +345,7 @@ std::set<PyObject *> BindingManager::getAllPyObjects()
void BindingManager::visitAllPyObjects(ObjectVisitor visitor, void *data)
{
WrapperMap copy = m_d->wrapperMapper;
- for (WrapperMap::iterator it = copy.begin(); it != copy.end(); ++it) {
+ for (auto it = copy.begin(); it != copy.end(); ++it) {
if (hasWrapper(it->first))
visitor(it->second, data);
}
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
index 8a2930fc..ed205626 100644
--- a/sources/shiboken2/libshiboken/pep384impl.cpp
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp
@@ -123,13 +123,13 @@ static PyType_Spec typeprobe_spec = {
static void
check_PyTypeObject_valid(void)
{
- PyObject *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
- PyTypeObject *probe_tp_base = reinterpret_cast<PyTypeObject *>(
+ auto *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
+ auto *probe_tp_base = reinterpret_cast<PyTypeObject *>(
PyObject_GetAttrString(obtype, "__base__"));
PyObject *probe_tp_bases = PyObject_GetAttrString(obtype, "__bases__");
- PyTypeObject *check = reinterpret_cast<PyTypeObject *>(
+ auto *check = reinterpret_cast<PyTypeObject *>(
PyType_FromSpecWithBases(&typeprobe_spec, probe_tp_bases));
- PyTypeObject *typetype = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *typetype = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *w = PyObject_GetAttrString(obtype, "__weakrefoffset__");
long probe_tp_weakrefoffset = PyLong_AsLong(w);
PyObject *d = PyObject_GetAttrString(obtype, "__dictoffset__");
diff --git a/sources/shiboken2/libshiboken/sbkarrayconverter.cpp b/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
index 58e0b18a..fd09efda 100644
--- a/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
@@ -83,7 +83,7 @@ inline void convertPySequence(PyObject *pyIn, Converter c, T *out)
// Internal, for usage by numpy
SbkArrayConverter *createArrayConverter(IsArrayConvertibleToCppFunc toCppCheckFunc)
{
- SbkArrayConverter *result = new SbkArrayConverter;
+ auto *result = new SbkArrayConverter;
result->toCppConversions.push_back(toCppCheckFunc);
return result;
}
@@ -115,7 +115,7 @@ static short toShort(PyObject *pyIn) { return short(PyLong_AsLong(pyIn)); }
static void sequenceToCppShortArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<short> *handle = reinterpret_cast<ArrayHandle<short> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<short> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, toShort, handle->data());
}
@@ -148,7 +148,7 @@ static short toUnsignedShort(PyObject *pyIn) { return static_cast<unsigned short
static void sequenceToCppUnsignedShortArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned short> *handle = reinterpret_cast<ArrayHandle<unsigned short> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned short> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, toUnsignedShort, handle->data());
}
@@ -160,7 +160,7 @@ static PythonToCppFunc sequenceToCppUnsignedShortArrayCheck(PyObject *pyIn, int
static void sequenceToCppIntArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<int> *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, _PepLong_AsInt, handle->data());
}
@@ -172,7 +172,7 @@ static PythonToCppFunc sequenceToCppIntArrayCheck(PyObject *pyIn, int dim1, int
static void sequenceToCppUnsignedArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned> *handle = reinterpret_cast<ArrayHandle<unsigned> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsUnsignedLong, handle->data());
}
@@ -184,7 +184,7 @@ static PythonToCppFunc sequenceToCppUnsignedArrayCheck(PyObject *pyIn, int dim1,
static void sequenceToCppLongLongArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<long long> *handle = reinterpret_cast<ArrayHandle<long long> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<long long> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsLongLong, handle->data());
}
@@ -196,7 +196,7 @@ static PythonToCppFunc sequenceToCppLongLongArrayCheck(PyObject *pyIn, int dim1,
static void sequenceToCppUnsignedLongLongArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned long long> *handle = reinterpret_cast<ArrayHandle<unsigned long long> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned long long> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsUnsignedLongLong, handle->data());
}
@@ -218,7 +218,7 @@ static inline bool floatArrayCheck(PyObject *pyIn, int expectedSize = -1)
static void sequenceToCppDoubleArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<double> *handle = reinterpret_cast<ArrayHandle<double> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<double> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyFloat_AsDouble, handle->data());
}
@@ -227,7 +227,7 @@ static inline float pyToFloat(PyObject *pyIn) { return float(PyFloat_AsDouble(py
static void sequenceToCppFloatArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<float> *handle = reinterpret_cast<ArrayHandle<float> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<float> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, pyToFloat, handle->data());
}
diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp
index 45551666..b5246932 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkconverter.cpp
@@ -206,7 +206,7 @@ PyObject *referenceToPython(const SbkConverter *converter, const void *cppIn)
{
assert(cppIn);
- PyObject *pyOut = reinterpret_cast<PyObject *>(BindingManager::instance().retrieveWrapper(cppIn));
+ auto *pyOut = reinterpret_cast<PyObject *>(BindingManager::instance().retrieveWrapper(cppIn));
if (pyOut) {
Py_INCREF(pyOut);
return pyOut;
@@ -295,7 +295,7 @@ void *cppPointer(PyTypeObject *desiredType, SbkObject *pyIn)
assert(pyIn);
if (!ObjectType::checkType(desiredType))
return pyIn;
- SbkObjectType *inType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyIn));
+ auto *inType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyIn));
if (ObjectType::hasCast(inType))
return ObjectType::cast(inType, pyIn, desiredType);
return Object::cppPointer(pyIn, desiredType);
@@ -367,7 +367,7 @@ bool isImplicitConversion(SbkObjectType *type, PythonToCppFunc toCppFunc)
void registerConverterName(SbkConverter *converter , const char *typeName)
{
- ConvertersMap::iterator iter = converters.find(typeName);
+ auto iter = converters.find(typeName);
if (iter == converters.end())
converters.insert(std::make_pair(typeName, converter));
}
diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp
index 78dba3c5..8f24cc19 100644
--- a/sources/shiboken2/libshiboken/sbkenum.cpp
+++ b/sources/shiboken2/libshiboken/sbkenum.cpp
@@ -86,7 +86,7 @@ static PyObject *SbkEnumObject_repr(PyObject *self)
static PyObject *SbkEnumObject_name(PyObject *self, void *)
{
- SbkEnumObject *enum_self = SBK_ENUM(self);
+ auto *enum_self = SBK_ENUM(self);
if (enum_self->ob_name == nullptr)
Py_RETURN_NONE;
@@ -326,7 +326,7 @@ void SbkEnumTypeDealloc(PyObject *pyObj)
PyObject *SbkEnumTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
- newfunc type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
+ auto type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
auto newType = reinterpret_cast<SbkEnumType *>(type_new(metatype, args, kwds));
if (!newType)
return nullptr;
@@ -368,7 +368,7 @@ PyObject *getEnumItemFromValue(PyTypeObject *enumType, long itemValue)
PyObject *values = PyDict_GetItemString(enumType->tp_dict, const_cast<char *>("values"));
while (PyDict_Next(values, &pos, &key, &value)) {
- SbkEnumObject *obj = reinterpret_cast<SbkEnumObject *>(value);
+ auto *obj = reinterpret_cast<SbkEnumObject *>(value);
if (obj->ob_value == itemValue) {
Py_INCREF(obj);
return value;
@@ -587,7 +587,7 @@ newTypeWithName(const char *name,
{
// Careful: PyType_FromSpec does not allocate the string.
PyType_Slot newslots[99] = {}; // enough but not too big for the stack
- PyType_Spec *newspec = new PyType_Spec;
+ auto *newspec = new PyType_Spec;
newspec->name = strdup(name);
newspec->basicsize = SbkNewType_spec.basicsize;
newspec->itemsize = SbkNewType_spec.itemsize;
@@ -602,11 +602,11 @@ newTypeWithName(const char *name,
if (numbers_fromFlag)
copyNumberMethods(numbers_fromFlag, newslots, &idx);
newspec->slots = newslots;
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(newspec));
+ auto *type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(newspec));
Py_TYPE(type) = SbkEnumType_TypeF();
Py_INCREF(Py_TYPE(type));
- SbkEnumType *enumType = reinterpret_cast<SbkEnumType *>(type);
+ auto *enumType = reinterpret_cast<SbkEnumType *>(type);
PepType_SETP(enumType)->cppName = cppName;
PepType_SETP(enumType)->converterPtr = &PepType_SETP(enumType)->converter;
DeclaredEnumTypes::instance().addEnumType(type);
diff --git a/sources/shiboken2/libshiboken/sbkmodule.cpp b/sources/shiboken2/libshiboken/sbkmodule.cpp
index 7bfbf51a..7864471c 100644
--- a/sources/shiboken2/libshiboken/sbkmodule.cpp
+++ b/sources/shiboken2/libshiboken/sbkmodule.cpp
@@ -84,27 +84,27 @@ PyObject *create(const char *moduleName, void *moduleData)
void registerTypes(PyObject *module, PyTypeObject **types)
{
- ModuleTypesMap::iterator iter = moduleTypes.find(module);
+ auto iter = moduleTypes.find(module);
if (iter == moduleTypes.end())
moduleTypes.insert(std::make_pair(module, types));
}
PyTypeObject **getTypes(PyObject *module)
{
- ModuleTypesMap::iterator iter = moduleTypes.find(module);
+ auto iter = moduleTypes.find(module);
return (iter == moduleTypes.end()) ? 0 : iter->second;
}
void registerTypeConverters(PyObject *module, SbkConverter **converters)
{
- ModuleConvertersMap::iterator iter = moduleConverters.find(module);
+ auto iter = moduleConverters.find(module);
if (iter == moduleConverters.end())
moduleConverters.insert(std::make_pair(module, converters));
}
SbkConverter **getTypeConverters(PyObject *module)
{
- ModuleConvertersMap::iterator iter = moduleConverters.find(module);
+ auto iter = moduleConverters.find(module);
return (iter == moduleConverters.end()) ? 0 : iter->second;
}
diff --git a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
index 8bc68079..996968fa 100644
--- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
@@ -138,7 +138,7 @@ static bool isPrimitiveArray(PyObject *pyIn, int expectedNpType)
{
if (!PyArray_Check(pyIn))
return false;
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
if (debugNumPy) {
std::cerr << __FUNCTION__ << "(expectedNpType=" << expectedNpType;
if (const char *name = npTypeName(expectedNpType))
@@ -176,7 +176,7 @@ static inline bool primitiveArrayCheck1(PyObject *pyIn, int expectedNpType, int
if (!isPrimitiveArray<1>(pyIn, expectedNpType))
return false;
if (expectedSize >= 0) {
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const int size = int(PyArray_DIMS(pya)[0]);
if (size < expectedSize) {
warning(PyExc_RuntimeWarning, 0, "A numpy array of size %d was passed to a function expects %d.",
@@ -191,8 +191,8 @@ static inline bool primitiveArrayCheck1(PyObject *pyIn, int expectedNpType, int
template <class T>
static void convertArray1(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<T> *handle = reinterpret_cast<ArrayHandle<T> *>(cppOut);
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *handle = reinterpret_cast<ArrayHandle<T> *>(cppOut);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const npy_intp size = PyArray_DIMS(pya)[0];
if (debugNumPy)
std::cerr << __FUNCTION__ << ' ' << size << '\n';
@@ -204,8 +204,8 @@ template <class T>
static void convertArray2(PyObject *pyIn, void *cppOut)
{
typedef typename Array2Handle<T, 1>::RowType RowType;
- Array2Handle<T, 1> *handle = reinterpret_cast<Array2Handle<T, 1> *>(cppOut);
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *handle = reinterpret_cast<Array2Handle<T, 1> *>(cppOut);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
handle->setData(reinterpret_cast<RowType *>(PyArray_DATA(pya)));
}
@@ -220,7 +220,7 @@ static inline bool primitiveArrayCheck2(PyObject *pyIn, int expectedNpType, int
if (!isPrimitiveArray<2>(pyIn, expectedNpType))
return false;
if (expectedDim2 >= 0) {
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const int dim1 = int(PyArray_DIMS(pya)[0]);
const int dim2 = int(PyArray_DIMS(pya)[1]);
if (dim1 != expectedDim1 || dim2 != expectedDim2) {
diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp
index 6d40ce42..ad53458c 100644
--- a/sources/shiboken2/libshiboken/signature.cpp
+++ b/sources/shiboken2/libshiboken/signature.cpp
@@ -234,7 +234,7 @@ compute_name_key(PyObject *ob)
static int
build_name_key_to_func(PyObject *obtype)
{
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *type = reinterpret_cast<PyTypeObject *>(obtype);
PyMethodDef *meth = type->tp_methods;
if (meth == nullptr)
@@ -457,7 +457,7 @@ static safe_globals_struc *
init_phase_1(void)
{
{
- safe_globals_struc *p = reinterpret_cast<safe_globals_struc *>
+ auto *p = reinterpret_cast<safe_globals_struc *>
(malloc(sizeof(safe_globals_struc)));
if (p == nullptr)
goto error;
@@ -675,7 +675,7 @@ handle_doc(PyObject *ob, PyObject *old_descr)
init_module_1();
init_module_2();
Shiboken::AutoDecRef ob_type(GetClassOfFunc(ob));
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(ob_type.object());
+ auto *type = reinterpret_cast<PyTypeObject *>(ob_type.object());
if (handle_doc_in_progress || strncmp(type->tp_name, "PySide2.", 8) != 0)
return PyObject_CallMethod(old_descr, const_cast<char *>("__get__"), const_cast<char *>("(O)"), ob);
handle_doc_in_progress++;
@@ -1056,7 +1056,7 @@ _build_func_to_type(PyObject *obtype)
* and record the mapping from static method to this type in a dict.
* We also check for hidden methods, see below.
*/
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *type = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *dict = type->tp_dict;
PyMethodDef *meth = type->tp_methods;
@@ -1128,7 +1128,7 @@ SbkSpecial_Type_Ready(PyObject *module, PyTypeObject *type,
{
if (PyType_Ready(type) < 0)
return -1;
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
int ret = PySide_BuildSignatureArgs(ob_type, signatures);
if (ret < 0) {
PyErr_Print();
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
index 0dceefc2..2728b24c 100644
--- a/sources/shiboken2/libshiboken/voidptr.cpp
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -61,7 +61,7 @@ PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject *args, PyObject *kwd
// SbkVoidPtrObject *self =
// reinterpret_cast<SbkVoidPtrObject *>(type->tp_alloc);
PyObject *ob = type->tp_alloc(type, 0);
- SbkVoidPtrObject *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
+ auto *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
if (self != nullptr) {
self->cptr = nullptr;
@@ -80,7 +80,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *addressObject;
Py_ssize_t size = -1;
int isWritable = 0;
- SbkVoidPtrObject *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
static const char *kwlist[] = {"address", "size", "writeable", nullptr};
@@ -90,7 +90,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
// Void pointer.
if (SbkVoidPtr_Check(addressObject)) {
- SbkVoidPtrObject *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
+ auto *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
sbkSelf->cptr = sbkOther->cptr;
sbkSelf->size = sbkOther->size;
sbkSelf->isWritable = sbkOther->isWritable;
@@ -112,7 +112,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
}
// Shiboken::Object wrapper.
else if (Shiboken::Object::checkType(addressObject)) {
- SbkObject *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
+ auto *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
sbkSelf->cptr = sbkOther->d->cptr[0];
sbkSelf->size = size;
sbkSelf->isWritable = isWritable > 0 ? true : false;
@@ -178,13 +178,13 @@ PyObject *SbkVoidPtrObject_richcmp(PyObject *obj1, PyObject *obj2, int op)
PyObject *SbkVoidPtrObject_int(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
return PyLong_FromVoidPtr(sbkObject->cptr);
}
PyObject *toBytes(PyObject *self, PyObject *args)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
if (sbkObject->size < 0) {
PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
return nullptr;
@@ -202,7 +202,7 @@ static struct PyMethodDef SbkVoidPtrObject_methods[] = {
static Py_ssize_t SbkVoidPtrObject_length(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
if (sbkObject->size < 0) {
PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
return -1;
@@ -218,7 +218,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
#ifdef IS_PY3K
PyObject *s = PyUnicode_FromFormat("%s(%p, %zd, %s)",
#else
@@ -234,7 +234,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
PyObject *SbkVoidPtrObject_str(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
#ifdef IS_PY3K
PyObject *s = PyUnicode_FromFormat("%s(Address %p, Size %zd, isWritable %s)",
#else
@@ -254,7 +254,7 @@ static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
if (view == nullptr)
return -1;
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
if (sbkObject->size < 0)
return -1;
@@ -410,7 +410,7 @@ static PyObject *toPython(const void *cppIn)
static void VoidPtrToCpp(PyObject *pyIn, void *cppOut)
{
- SbkVoidPtrObject *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
+ auto *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
*reinterpret_cast<void **>(cppOut) = sbkIn->cptr;
}
@@ -421,7 +421,7 @@ static PythonToCppFunc VoidPtrToCppIsConvertible(PyObject *pyIn)
static void SbkObjectToCpp(PyObject *pyIn, void *cppOut)
{
- SbkObject *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
+ auto *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
*reinterpret_cast<void **>(cppOut) = sbkIn->d->cptr[0];
}