aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp171
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h12
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp92
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h25
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h16
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.cpp14
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.h10
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp10
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.h8
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.h10
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp5
-rw-r--r--sources/shiboken2/ApiExtractor/dependency.h2
-rw-r--r--sources/shiboken2/ApiExtractor/docparser.h2
-rw-r--r--sources/shiboken2/ApiExtractor/doxygenparser.h2
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.h2
-rw-r--r--sources/shiboken2/ApiExtractor/graph.cpp12
-rw-r--r--sources/shiboken2/ApiExtractor/graph.h2
-rw-r--r--sources/shiboken2/ApiExtractor/header_paths.h2
-rw-r--r--sources/shiboken2/ApiExtractor/include.h6
-rw-r--r--sources/shiboken2/ApiExtractor/merge.xsl16
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp43
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h24
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h52
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.cpp4
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.h2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testutil.h4
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp46
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h60
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase_typedefs.h16
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp56
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h30
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_p.h2
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_typedefs.h8
40 files changed, 387 insertions, 401 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index c4f51737..c91ac4dd 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -62,7 +62,7 @@ static QString stripTemplateArgs(const QString &name)
return pos < 0 ? name : name.left(pos);
}
-static QStringList parseTemplateType(const QString& name) {
+static QStringList parseTemplateType(const QString &name) {
int n = name.indexOf(QLatin1Char('<'));
if (n <= 0) {
// If name starts with '<' or contains an unmatched (i.e. any) '>', we
@@ -112,8 +112,7 @@ static QStringList parseTemplateType(const QString& name) {
}
AbstractMetaBuilderPrivate::AbstractMetaBuilderPrivate() :
- m_logDirectory(QLatin1String(".") + QDir::separator()),
- m_skipDeprecated(false)
+ m_logDirectory(QLatin1String(".") + QDir::separator())
{
}
@@ -164,7 +163,7 @@ AbstractMetaEnumList AbstractMetaBuilder::globalEnums() const
AbstractMetaEnum *AbstractMetaBuilder::findEnum(const TypeEntry *typeEntry) const
{
if (typeEntry && typeEntry->isFlags())
- typeEntry = static_cast<const FlagsTypeEntry*>(typeEntry)->originator();
+ typeEntry = static_cast<const FlagsTypeEntry *>(typeEntry)->originator();
return d->m_enums.value(typeEntry);
}
@@ -179,7 +178,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
if (!entry->isComplex() || entry->codeGeneration() == TypeEntry::GenerateNothing)
continue;
- const ComplexTypeEntry* centry = static_cast<const ComplexTypeEntry*>(entry);
+ auto centry = static_cast<const ComplexTypeEntry *>(entry);
if (!(centry->codeGeneration() & TypeEntry::GenerateTargetLang))
continue;
@@ -226,7 +225,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
AbstractMetaClass *AbstractMetaBuilderPrivate::argumentToClass(const ArgumentModelItem &argument,
AbstractMetaClass *currentClass)
{
- AbstractMetaClass* returned = 0;
+ AbstractMetaClass *returned = nullptr;
AbstractMetaType *type = translateType(argument->type(), currentClass);
if (type && type->typeEntry() && type->typeEntry()->isComplex()) {
const TypeEntry *entry = type->typeEntry();
@@ -306,7 +305,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
// Strip away first argument, since that is the containing object
AbstractMetaArgumentList arguments = metaFunction->arguments();
if (firstArgumentIsSelf || unaryOperator) {
- AbstractMetaArgument* first = arguments.takeFirst();
+ AbstractMetaArgument *first = arguments.takeFirst();
if (!unaryOperator && first->type()->indirections())
metaFunction->setPointerOperator(true);
delete first;
@@ -317,7 +316,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
// must be an reverse operator (e.g. CLASS::operator(TYPE, CLASS)).
// All operator overloads that operate over a class are already
// being added as member functions of that class by the API Extractor.
- AbstractMetaArgument* last = arguments.takeLast();
+ AbstractMetaArgument *last = arguments.takeLast();
if (last->type()->indirections())
metaFunction->setPointerOperator(true);
delete last;
@@ -442,7 +441,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
ReportHandler::startProgress("Generating enum model ("
+ QByteArray::number(enums.size()) + ")...");
for (const EnumModelItem &item : enums) {
- AbstractMetaEnum *metaEnum = traverseEnum(item, 0, QSet<QString>());
+ AbstractMetaEnum *metaEnum = traverseEnum(item, nullptr, QSet<QString>());
if (metaEnum) {
if (metaEnum->typeEntry()->generateCode())
m_globalEnums << metaEnum;
@@ -479,11 +478,11 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
if (func->accessPolicy() != CodeModel::Public || func->name().startsWith(QLatin1String("operator")))
continue;
- FunctionTypeEntry* funcEntry = types->findFunctionType(func->name());
+ FunctionTypeEntry *funcEntry = types->findFunctionType(func->name());
if (!funcEntry || !funcEntry->generateCode())
continue;
- AbstractMetaFunction* metaFunc = traverseFunction(func, nullptr);
+ AbstractMetaFunction *metaFunc = traverseFunction(func, nullptr);
if (!metaFunc)
continue;
@@ -551,11 +550,11 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
<< QStringLiteral("type '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
.arg(entry->qualifiedCppName());
} else if (entry->generateCode() && entry->type() == TypeEntry::FunctionType) {
- const FunctionTypeEntry* fte = static_cast<const FunctionTypeEntry*>(entry);
+ auto fte = static_cast<const FunctionTypeEntry *>(entry);
const QStringList &signatures = fte->signatures();
for (const QString &signature : signatures) {
bool ok = false;
- for (AbstractMetaFunction* func : qAsConst(m_globalFunctions)) {
+ for (AbstractMetaFunction *func : qAsConst(m_globalFunctions)) {
if (signature == func->minimalSignature()) {
ok = true;
break;
@@ -642,7 +641,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
// sort all classes topologically
m_metaClasses = classesTopologicalSorted(m_metaClasses);
- for (AbstractMetaClass* cls : qAsConst(m_metaClasses)) {
+ for (AbstractMetaClass *cls : qAsConst(m_metaClasses)) {
// setupEquals(cls);
// setupComparable(cls);
setupClonable(cls);
@@ -662,7 +661,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
// Functions added to the module on the type system.
const AddedFunctionList &globalUserFunctions = types->globalUserFunctions();
for (const AddedFunctionPtr &addedFunc : globalUserFunctions) {
- AbstractMetaFunction* metaFunc = traverseFunction(addedFunc);
+ AbstractMetaFunction *metaFunc = traverseFunction(addedFunc);
if (Q_UNLIKELY(!metaFunc)) {
qFatal("Unable to traverse added global function \"%s\".",
qPrintable(addedFunc->name()));
@@ -706,7 +705,7 @@ bool AbstractMetaBuilder::build(const QByteArrayList &arguments,
return true;
}
-void AbstractMetaBuilder::setLogDirectory(const QString& logDir)
+void AbstractMetaBuilder::setLogDirectory(const QString &logDir)
{
d->m_logDirectory = logDir;
if (!d->m_logDirectory.endsWith(QDir::separator()))
@@ -725,7 +724,7 @@ void AbstractMetaBuilderPrivate::addAbstractMetaClass(AbstractMetaClass *cls,
} else {
m_metaClasses << cls;
if (cls->typeEntry()->designatedInterface()) {
- AbstractMetaClass* interface = cls->extractInterface();
+ AbstractMetaClass *interface = cls->extractInterface();
m_metaClasses << interface;
if (ReportHandler::isDebug(ReportHandler::SparseDebug))
qCDebug(lcShiboken) << QStringLiteral(" -> interface '%1'").arg(interface->name());
@@ -743,14 +742,14 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
if (TypeDatabase::instance()->isClassRejected(namespaceName)) {
m_rejectedClasses.insert(namespaceName, AbstractMetaBuilder::GenerationDisabled);
- return 0;
+ return nullptr;
}
auto type = TypeDatabase::instance()->findNamespaceType(namespaceName, namespaceItem->fileName());
if (!type) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("namespace '%1' does not have a type entry").arg(namespaceName);
- return 0;
+ return nullptr;
}
// Continue populating namespace?
@@ -784,7 +783,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
const ClassList &classes = namespaceItem->classes();
for (const ClassModelItem &cls : classes) {
- AbstractMetaClass* mjc = traverseClass(dom, cls, metaClass);
+ AbstractMetaClass *mjc = traverseClass(dom, cls, metaClass);
if (mjc) {
metaClass->addInnerClass(mjc);
mjc->setEnclosingClass(metaClass);
@@ -806,7 +805,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
// Traverse namespaces recursively
for (const NamespaceModelItem &ni : namespaceItem->namespaces()) {
- AbstractMetaClass* mjc = traverseNamespace(dom, ni);
+ AbstractMetaClass *mjc = traverseNamespace(dom, ni);
if (mjc) {
metaClass->addInnerClass(mjc);
mjc->setEnclosingClass(metaClass);
@@ -827,7 +826,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
{
QString qualifiedName = enumItem->qualifiedName().join(colonColon());
- TypeEntry* typeEntry = 0;
+ TypeEntry *typeEntry = nullptr;
if (enumItem->accessPolicy() == CodeModel::Private) {
QStringList names = enumItem->qualifiedName();
const QString &enumName = names.constLast();
@@ -841,7 +840,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
} else {
QStringList tmpQualifiedName = enumItem->qualifiedName();
const EnumeratorList &enums = enumItem->enumerators();
- for (const EnumeratorModelItem& enumValue : enums) {
+ for (const EnumeratorModelItem &enumValue : enums) {
tmpQualifiedName.removeLast();
tmpQualifiedName << enumValue->name();
qualifiedName = tmpQualifiedName.join(colonColon());
@@ -862,7 +861,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
if (typeEntry)
typeEntry->setCodeGeneration(TypeEntry::GenerateNothing);
m_rejectedEnums.insert(qualifiedName + rejectReason, AbstractMetaBuilder::GenerationDisabled);
- return 0;
+ return nullptr;
}
const bool rejectionWarning = !enclosing
@@ -884,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)
@@ -892,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:
@@ -915,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...
@@ -964,11 +963,11 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
return metaEnum;
}
-AbstractMetaClass* AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelItem &dom,
+AbstractMetaClass *AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelItem &,
const TypeDefModelItem &typeDef,
AbstractMetaClass *currentClass)
{
- TypeDatabase* types = TypeDatabase::instance();
+ TypeDatabase *types = TypeDatabase::instance();
QString className = stripTemplateArgs(typeDef->name());
QString fullClassName = className;
@@ -981,20 +980,20 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelIt
// If this is the alias for a primitive type
// we store the aliased type on the alias
// TypeEntry
- PrimitiveTypeEntry* ptype = types->findPrimitiveType(className);
+ PrimitiveTypeEntry *ptype = types->findPrimitiveType(className);
if (ptype) {
QString typeDefName = typeDef->type().qualifiedName()[0];
ptype->setReferencedTypeEntry(types->findPrimitiveType(typeDefName));
- return 0;
+ return nullptr;
}
// If we haven't specified anything for the typedef, then we don't care
- ComplexTypeEntry* type = types->findComplexType(fullClassName);
+ ComplexTypeEntry *type = types->findComplexType(fullClassName);
if (!type)
- return 0;
+ return nullptr;
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeDef(true);
metaClass->setTypeEntry(type);
metaClass->setBaseClassNames(QStringList(typeDef->type().toString()));
@@ -1015,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()));
@@ -1038,7 +1037,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
+ colonColon() + fullClassName;
}
- ComplexTypeEntry* type = TypeDatabase::instance()->findComplexType(fullClassName);
+ ComplexTypeEntry *type = TypeDatabase::instance()->findComplexType(fullClassName);
AbstractMetaBuilder::RejectReason reason = AbstractMetaBuilder::NoReason;
if (TypeDatabase::instance()->isClassRejected(fullClassName)) {
@@ -1054,10 +1053,10 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
}
if (reason != AbstractMetaBuilder::NoReason) {
m_rejectedClasses.insert(fullClassName, reason);
- return 0;
+ return nullptr;
}
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeEntry(type);
if (classItem->isFinal())
@@ -1129,7 +1128,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
return metaClass;
}
-void AbstractMetaBuilderPrivate::traverseScopeMembers(ScopeModelItem item,
+void AbstractMetaBuilderPrivate::traverseScopeMembers(const ScopeModelItem &item,
AbstractMetaClass *metaClass)
{
// Classes/Namespace members
@@ -1138,13 +1137,13 @@ void AbstractMetaBuilderPrivate::traverseScopeMembers(ScopeModelItem item,
// Inner classes
const ClassList &innerClasses = item->classes();
- for (const ClassModelItem& ci : innerClasses)
+ for (const ClassModelItem &ci : innerClasses)
traverseClassMembers(ci);
}
-void AbstractMetaBuilderPrivate::traverseClassMembers(ClassModelItem item)
+void AbstractMetaBuilderPrivate::traverseClassMembers(const ClassModelItem &item)
{
- AbstractMetaClass* metaClass = m_itemToClass.value(item.data());
+ AbstractMetaClass *metaClass = m_itemToClass.value(item.data());
if (!metaClass)
return;
@@ -1152,9 +1151,9 @@ void AbstractMetaBuilderPrivate::traverseClassMembers(ClassModelItem item)
traverseScopeMembers(item, metaClass);
}
-void AbstractMetaBuilderPrivate::traverseNamespaceMembers(NamespaceModelItem item)
+void AbstractMetaBuilderPrivate::traverseNamespaceMembers(const NamespaceModelItem &item)
{
- AbstractMetaClass* metaClass = m_itemToClass.value(item.data());
+ AbstractMetaClass *metaClass = m_itemToClass.value(item.data());
if (!metaClass)
return;
@@ -1186,20 +1185,20 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(const VariableModel
// Ignore friend decl.
if (field->isFriend())
- return 0;
+ return nullptr;
if (field->accessPolicy() == CodeModel::Private)
- return 0;
+ return nullptr;
QString rejectReason;
if (TypeDatabase::instance()->isFieldRejected(className, fieldName, &rejectReason)) {
m_rejectedFields.insert(qualifiedFieldSignatureWithType(className, field) + rejectReason,
AbstractMetaBuilder::GenerationDisabled);
- return 0;
+ return nullptr;
}
- AbstractMetaField *metaField = new AbstractMetaField;
+ auto *metaField = new AbstractMetaField;
metaField->setName(fieldName);
metaField->setEnclosingClass(cls);
@@ -1214,12 +1213,12 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(const VariableModel
.arg(cls->name(), fieldName, type);
}
delete metaField;
- return 0;
+ return nullptr;
}
metaField->setType(metaType);
- AbstractMetaAttributes::Attributes attr = 0;
+ AbstractMetaAttributes::Attributes attr = nullptr;
if (field->isStatic())
attr |= AbstractMetaAttributes::Static;
@@ -1240,7 +1239,7 @@ void AbstractMetaBuilderPrivate::traverseFields(const ScopeModelItem &scope_item
{
const VariableList &variables = scope_item->variables();
for (const VariableModelItem &field : variables) {
- AbstractMetaField* metaField = traverseField(field, metaClass);
+ AbstractMetaField *metaField = traverseField(field, metaClass);
if (metaField && !metaField->isModifiedRemoved()) {
metaField->setOriginalAttributes(metaField->attributes());
@@ -1269,7 +1268,7 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
if (!metaFunction->isConversionOperator())
return;
- TypeDatabase* types = TypeDatabase::instance();
+ TypeDatabase *types = TypeDatabase::instance();
static const QRegularExpression operatorRegExp(QStringLiteral("^operator "));
Q_ASSERT(operatorRegExp.isValid());
QString castTo = metaFunction->name().remove(operatorRegExp).trimmed();
@@ -1279,22 +1278,22 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
if (castTo.startsWith(QLatin1String("const ")))
castTo.remove(0, 6);
- TypeEntry* retType = types->findType(castTo);
+ TypeEntry *retType = types->findType(castTo);
if (!retType)
return;
- AbstractMetaType* metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(retType);
metaFunction->replaceType(metaType);
}
-static bool _compareAbstractMetaTypes(const AbstractMetaType* type, const AbstractMetaType* other)
+static bool _compareAbstractMetaTypes(const AbstractMetaType *type, const AbstractMetaType *other)
{
return (type != nullptr) == (other != nullptr)
&& (type == nullptr || *type == *other);
}
-static bool _compareAbstractMetaFunctions(const AbstractMetaFunction* func, const AbstractMetaFunction* other)
+static bool _compareAbstractMetaFunctions(const AbstractMetaFunction *func, const AbstractMetaFunction *other)
{
if (!func && !other)
return true;
@@ -1317,7 +1316,7 @@ AbstractMetaFunctionList AbstractMetaBuilderPrivate::classFunctionList(const Sco
AbstractMetaClass::Attributes *constructorAttributes,
AbstractMetaClass *currentClass)
{
- *constructorAttributes = 0;
+ *constructorAttributes = nullptr;
AbstractMetaFunctionList result;
const FunctionList &scopeFunctionList = scopeItem->functions();
result.reserve(scopeFunctionList.size());
@@ -1370,21 +1369,22 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem,
if (metaClass->isNamespace())
*metaFunction += AbstractMetaAttributes::Static;
- QPropertySpec *read = 0;
+ QPropertySpec *read = nullptr;
if (!metaFunction->isSignal() && (read = metaClass->propertySpecForRead(metaFunction->name()))) {
// Property reader must be in the form "<type> name()"
- if (metaFunction->type() && (read->type() == metaFunction->type()->typeEntry()) && (metaFunction->arguments().size() == 0)) {
+ if (metaFunction->type() && (read->type() == metaFunction->type()->typeEntry())
+ && metaFunction->arguments().isEmpty()) {
*metaFunction += AbstractMetaAttributes::PropertyReader;
metaFunction->setPropertySpec(read);
}
- } else if (QPropertySpec* write = metaClass->propertySpecForWrite(metaFunction->name())) {
+ } else if (QPropertySpec *write = metaClass->propertySpecForWrite(metaFunction->name())) {
// Property setter must be in the form "void name(<type>)"
// make sure the function was created with all aguments, some argument can be missing during the pareser because of errors on typesystem
if ((!metaFunction->type()) && (metaFunction->arguments().size() == 1) && (write->type() == metaFunction->arguments().at(0)->type()->typeEntry())) {
*metaFunction += AbstractMetaAttributes::PropertyWriter;
metaFunction->setPropertySpec(write);
}
- } else if (QPropertySpec* reset = metaClass->propertySpecForReset(metaFunction->name())) {
+ } else if (QPropertySpec *reset = metaClass->propertySpecForReset(metaFunction->name())) {
// Property resetter must be in the form "void name()"
if ((!metaFunction->type()) && metaFunction->arguments().isEmpty()) {
*metaFunction += AbstractMetaAttributes::PropertyResetter;
@@ -1435,7 +1435,7 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem,
}
if (!metaFunction->ownerClass()) {
delete metaFunction;
- metaFunction = 0;
+ metaFunction = nullptr;
}
}
@@ -1606,13 +1606,13 @@ void AbstractMetaBuilderPrivate::traverseEnums(const ScopeModelItem &scopeItem,
AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFunctionPtr &addedFunc)
{
- return traverseFunction(addedFunc, 0);
+ return traverseFunction(addedFunc, nullptr);
}
AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFunctionPtr &addedFunc,
AbstractMetaClass *metaClass)
{
- AbstractMetaFunction *metaFunction = new AbstractMetaFunction(addedFunc);
+ auto *metaFunction = new AbstractMetaFunction(addedFunc);
metaFunction->setType(translateType(addedFunc->returnType()));
@@ -1621,7 +1621,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,
@@ -1835,7 +1835,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
if (functionItem->isFriend())
- return 0;
+ return nullptr;
const bool deprecated = functionItem->isDeprecated();
if (deprecated && m_skipDeprecated) {
@@ -1844,7 +1844,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
}
- AbstractMetaFunction *metaFunction = new AbstractMetaFunction;
+ auto *metaFunction = new AbstractMetaFunction;
if (deprecated)
*metaFunction += AbstractMetaAttributes::Deprecated;
@@ -1959,7 +1959,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
}
break;
}
- Q_ASSERT(metaType == 0);
+ Q_ASSERT(metaType == nullptr);
const QString reason = msgUnmatchedParameterType(arg, i, errorMessage);
qCWarning(lcShiboken, "%s",
qPrintable(msgSkippingFunction(functionItem, originalQualifiedSignatureWithReturn, reason)));
@@ -1970,7 +1970,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
}
- AbstractMetaArgument *metaArgument = new AbstractMetaArgument;
+ auto *metaArgument = new AbstractMetaArgument;
metaArgument->setType(metaType);
metaArgument->setName(arg->name());
@@ -2075,7 +2075,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
QString typeName = typeInfo.name;
if (typeName == QLatin1String("void"))
- return 0;
+ return nullptr;
type = typeDb->findType(typeName);
@@ -2117,7 +2117,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)
@@ -2136,7 +2136,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
static const TypeEntry* findTypeEntryUsingContext(const AbstractMetaClass* metaClass, const QString& qualifiedName)
{
- const TypeEntry* type = 0;
+ const TypeEntry* type = nullptr;
QStringList context = metaClass->qualifiedCppName().split(colonColon());
while (!type && !context.isEmpty()) {
type = TypeDatabase::instance()->findType(context.join(colonColon()) + colonColon() + qualifiedName);
@@ -2231,7 +2231,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()) {
@@ -2270,7 +2270,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
typeInfo.clearInstantiations();
}
- const TypeEntry *type = 0;
+ const TypeEntry *type = nullptr;
// 5. Try to find the type
// 5.1 - Try first using the current scope
@@ -2321,7 +2321,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());
@@ -2539,7 +2539,7 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::findTemplateClass(const QString &
if (info)
*info = parsed;
- AbstractMetaClass* templ = 0;
+ AbstractMetaClass *templ = nullptr;
for (AbstractMetaClass *c : qAsConst(m_templates)) {
if (c->typeEntry()->name() == qualifiedName) {
templ = c;
@@ -2557,7 +2557,7 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::findTemplateClass(const QString &
*baseContainerType = types->findContainerType(qualifiedName);
}
- return 0;
+ return nullptr;
}
AbstractMetaClassList AbstractMetaBuilderPrivate::getBaseClasses(const AbstractMetaClass *metaClass) const
@@ -2565,7 +2565,7 @@ AbstractMetaClassList AbstractMetaBuilderPrivate::getBaseClasses(const AbstractM
AbstractMetaClassList baseClasses;
const QStringList &baseClassNames = metaClass->baseClassNames();
for (const QString& parent : baseClassNames) {
- AbstractMetaClass* cls = 0;
+ AbstractMetaClass *cls = nullptr;
if (parent.contains(QLatin1Char('<')))
cls = findTemplateClass(parent, metaClass);
else
@@ -2603,7 +2603,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.
@@ -2685,7 +2685,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());
@@ -2837,7 +2837,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);
@@ -2867,7 +2867,7 @@ static AbstractMetaFunction* findCopyCtor(AbstractMetaClass* cls)
if (t == AbstractMetaFunction::CopyConstructorFunction || t == AbstractMetaFunction::AssignmentOperatorFunction)
return f;
}
- return 0;
+ return nullptr;
}
void AbstractMetaBuilderPrivate::setupClonable(AbstractMetaClass *cls)
@@ -3200,13 +3200,12 @@ template <class Container>
static void debugFormatSequence(QDebug &d, const char *key, const Container& c,
const char *separator = ", ")
{
- typedef typename Container::const_iterator ConstIt;
if (c.isEmpty())
return;
- const ConstIt begin = c.begin();
- const ConstIt end = c.end();
+ const auto begin = c.begin();
+ const auto end = c.end();
d << "\n " << key << '[' << c.size() << "]=(";
- for (ConstIt it = begin; it != end; ++it) {
+ for (auto it = begin; it != end; ++it) {
if (it != begin)
d << separator;
d << *it;
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
index 1fd5f3c3..fec2eddb 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
@@ -43,6 +43,8 @@ class TypeDatabase;
class AbstractMetaBuilderPrivate
{
public:
+ Q_DISABLE_COPY(AbstractMetaBuilderPrivate)
+
AbstractMetaBuilderPrivate();
~AbstractMetaBuilderPrivate();
@@ -71,9 +73,9 @@ public:
AbstractMetaClass *traverseClass(const FileModelItem &dom,
const ClassModelItem &item,
AbstractMetaClass *currentClass);
- void traverseScopeMembers(ScopeModelItem item, AbstractMetaClass *metaClass);
- void traverseClassMembers(ClassModelItem scopeItem);
- void traverseNamespaceMembers(NamespaceModelItem scopeItem);
+ void traverseScopeMembers(const ScopeModelItem &item, AbstractMetaClass *metaClass);
+ void traverseClassMembers(const ClassModelItem &scopeItem);
+ void traverseNamespaceMembers(const NamespaceModelItem &scopeItem);
bool setupInheritance(AbstractMetaClass *metaClass);
AbstractMetaClass *traverseNamespace(const FileModelItem &dom,
const NamespaceModelItem &item);
@@ -173,7 +175,7 @@ public:
AbstractMetaFunctionList m_globalFunctions;
AbstractMetaEnumList m_globalEnums;
- typedef QMap<QString, AbstractMetaBuilder::RejectReason> RejectMap;
+ using RejectMap = QMap<QString, AbstractMetaBuilder::RejectReason>;
RejectMap m_rejectedClasses;
RejectMap m_rejectedEnums;
@@ -190,7 +192,7 @@ public:
QFileInfo m_globalHeader;
QStringList m_headerPaths;
mutable QHash<QString, Include> m_resolveIncludeHash;
- bool m_skipDeprecated;
+ bool m_skipDeprecated = false;
};
#endif // ABSTRACTMETBUILDER_P_H
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index 512efef5..455140e5 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());
@@ -198,9 +198,9 @@ AbstractMetaType *AbstractMetaType::copy() const
cpy->setInstantiations(instantiations());
cpy->setArrayElementCount(arrayElementCount());
cpy->setOriginalTypeDescription(originalTypeDescription());
- cpy->setOriginalTemplateType(originalTemplateType() ? originalTemplateType()->copy() : 0);
+ cpy->setOriginalTemplateType(originalTemplateType() ? originalTemplateType()->copy() : nullptr);
- cpy->setArrayElementType(arrayElementType() ? arrayElementType()->copy() : 0);
+ cpy->setArrayElementType(arrayElementType() ? arrayElementType()->copy() : nullptr);
cpy->setTypeEntry(typeEntry());
@@ -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;
}
@@ -519,7 +519,7 @@ bool AbstractMetaFunction::operator<(const AbstractMetaFunction &other) const
*/
AbstractMetaFunction::CompareResult AbstractMetaFunction::compareTo(const AbstractMetaFunction *other) const
{
- CompareResult result = 0;
+ CompareResult result = nullptr;
// Enclosing class...
if (ownerClass() == other->ownerClass())
@@ -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());
@@ -963,7 +963,7 @@ QString AbstractMetaFunction::debugSignature() const
return result;
}
-FunctionModificationList AbstractMetaFunction::modifications(const AbstractMetaClass* implementor) const
+FunctionModificationList AbstractMetaFunction::modifications(const AbstractMetaClass *implementor) const
{
if (!m_addedFunction.isNull())
return m_addedFunction->modifications;
@@ -1042,7 +1042,7 @@ bool AbstractMetaFunction::hasSignatureModifications() const
return false;
}
-bool AbstractMetaFunction::isConversionOperator(const QString& funcName)
+bool AbstractMetaFunction::isConversionOperator(const QString &funcName)
{
static const QRegularExpression opRegEx(QStringLiteral("^operator(?:\\s+(?:const|volatile))?\\s+(\\w+\\s*)&?$"));
Q_ASSERT(opRegEx.isValid());
@@ -1107,7 +1107,7 @@ bool AbstractMetaFunction::generateExceptionHandling() const
return result;
}
-bool AbstractMetaFunction::isOperatorOverload(const QString& funcName)
+bool AbstractMetaFunction::isOperatorOverload(const QString &funcName)
{
if (isConversionOperator(funcName))
return true;
@@ -1406,9 +1406,9 @@ AbstractMetaClass *AbstractMetaClass::extractInterface()
Q_ASSERT(typeEntry()->designatedInterface());
if (!m_extractedInterface) {
- AbstractMetaClass *iface = new AbstractMetaClass;
+ auto *iface = new AbstractMetaClass;
iface->setAttributes(attributes());
- iface->setBaseClass(0);
+ iface->setBaseClass(nullptr);
iface->setTypeEntry(typeEntry()->designatedInterface());
@@ -1679,7 +1679,7 @@ bool AbstractMetaClass::hasFunction(const QString &str) const
return findFunction(str);
}
-const AbstractMetaFunction* AbstractMetaClass::findFunction(const QString& functionName) const
+const AbstractMetaFunction *AbstractMetaClass::findFunction(const QString &functionName) const
{
return AbstractMetaFunction::find(m_functions, functionName);
}
@@ -1709,30 +1709,32 @@ bool AbstractMetaClass::hasProtectedMembers() const
QPropertySpec *AbstractMetaClass::propertySpecForRead(const QString &name) const
{
- for (int i = 0; i < m_propertySpecs.size(); ++i)
- if (name == m_propertySpecs.at(i)->read())
- return m_propertySpecs.at(i);
- return 0;
+ for (const auto &propertySpec : m_propertySpecs) {
+ if (name == propertySpec->read())
+ return propertySpec;
+ }
+ return nullptr;
}
QPropertySpec *AbstractMetaClass::propertySpecForWrite(const QString &name) const
{
- for (int i = 0; i < m_propertySpecs.size(); ++i)
- if (name == m_propertySpecs.at(i)->write())
- return m_propertySpecs.at(i);
- return 0;
+ for (const auto &propertySpec : m_propertySpecs) {
+ if (name == propertySpec->write())
+ return propertySpec;
+ }
+ return nullptr;
}
QPropertySpec *AbstractMetaClass::propertySpecForReset(const QString &name) const
{
- for (int i = 0; i < m_propertySpecs.size(); ++i) {
- if (name == m_propertySpecs.at(i)->reset())
- return m_propertySpecs.at(i);
+ for (const auto &propertySpec : m_propertySpecs) {
+ if (name == propertySpec->reset())
+ return propertySpec;
}
- return 0;
+ return nullptr;
}
-typedef QHash<const AbstractMetaClass*, AbstractMetaTypeList> AbstractMetaClassBaseTemplateInstantiationsMap;
+using AbstractMetaClassBaseTemplateInstantiationsMap = QHash<const AbstractMetaClass *, AbstractMetaTypeList>;
Q_GLOBAL_STATIC(AbstractMetaClassBaseTemplateInstantiationsMap, metaClassBaseTemplateInstantiations);
bool AbstractMetaClass::hasTemplateBaseClassInstantiations() const
@@ -1749,7 +1751,7 @@ AbstractMetaTypeList AbstractMetaClass::templateBaseClassInstantiations() const
return metaClassBaseTemplateInstantiations()->value(this);
}
-void AbstractMetaClass::setTemplateBaseClassInstantiations(AbstractMetaTypeList& instantiations)
+void AbstractMetaClass::setTemplateBaseClassInstantiations(AbstractMetaTypeList &instantiations)
{
if (!templateBaseClass())
return;
@@ -1782,7 +1784,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 +1824,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 +1882,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 +2002,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);
@@ -2018,20 +2020,20 @@ void AbstractMetaClass::addDefaultConstructor()
void AbstractMetaClass::addDefaultCopyConstructor(bool isPrivate)
{
- AbstractMetaFunction* f = new AbstractMetaFunction;
+ auto f = new AbstractMetaFunction;
f->setOriginalName(name());
f->setName(name());
f->setOwnerClass(this);
f->setFunctionType(AbstractMetaFunction::CopyConstructorFunction);
f->setDeclaringClass(this);
- AbstractMetaType* argType = new AbstractMetaType;
+ auto argType = new AbstractMetaType;
argType->setTypeEntry(typeEntry());
argType->setReferenceType(LValueReference);
argType->setConstant(true);
argType->setTypeUsagePattern(AbstractMetaType::ValuePattern);
- AbstractMetaArgument* arg = new AbstractMetaArgument;
+ auto arg = new AbstractMetaArgument;
arg->setType(argType);
arg->setName(name());
f->addArgument(arg);
@@ -2263,9 +2265,9 @@ static void addExtraIncludeForType(AbstractMetaClass *metaClass, const AbstractM
return;
Q_ASSERT(metaClass);
- const TypeEntry *entry = (type ? type->typeEntry() : 0);
+ 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());
@@ -2324,9 +2326,7 @@ void AbstractMetaClass::fixFunctions()
}
QSet<AbstractMetaFunction *> funcsToAdd;
- for (int sfi = 0; sfi < superFuncs.size(); ++sfi) {
- AbstractMetaFunction *sf = superFuncs.at(sfi);
-
+ for (auto sf : qAsConst(superFuncs)) {
if (sf->isRemovedFromAllLanguages(sf->implementingClass()))
continue;
@@ -2589,7 +2589,7 @@ AbstractMetaEnum *AbstractMetaClass::findEnum(const AbstractMetaClassList &class
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("AbstractMeta::findEnum(), unknown class '%1' in '%2'")
.arg(className, entry->qualifiedCppName());
- return 0;
+ return nullptr;
}
return metaClass->findEnum(enumName);
@@ -2601,8 +2601,8 @@ AbstractMetaEnumValue *AbstractMetaClass::findEnumValue(const AbstractMetaClassL
const QVector<QStringRef> lst = name.splitRef(QLatin1String("::"));
if (lst.size() > 1) {
- const QStringRef prefixName = lst.at(0);
- const QStringRef enumName = lst.at(1);
+ const QStringRef &prefixName = lst.at(0);
+ const QStringRef &enumName = lst.at(1);
if (AbstractMetaClass *cl = findClass(classes, prefixName.toString()))
return cl->findEnumValue(enumName.toString());
}
@@ -2626,7 +2626,7 @@ AbstractMetaClass *AbstractMetaClass::findClass(const AbstractMetaClassList &cla
const QString &name)
{
if (name.isEmpty())
- return 0;
+ return nullptr;
for (AbstractMetaClass *c : classes) {
if (c->qualifiedCppName() == name)
@@ -2643,17 +2643,17 @@ AbstractMetaClass *AbstractMetaClass::findClass(const AbstractMetaClassList &cla
return c;
}
- return 0;
+ return nullptr;
}
AbstractMetaClass *AbstractMetaClass::findClass(const AbstractMetaClassList &classes,
- const TypeEntry* typeEntry)
+ const TypeEntry *typeEntry)
{
- for (AbstractMetaClass* c : classes) {
+ for (AbstractMetaClass *c : classes) {
if (c->typeEntry() == typeEntry)
return c;
}
- return 0;
+ return nullptr;
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index e8ec21f4..afb4e5fb 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -72,7 +72,7 @@ public:
Target
};
- Documentation() {}
+ Documentation() = default;
Documentation(const QString& value, Format fmt = Documentation::Native)
: m_data(value.trimmed()), m_format(fmt) {}
@@ -105,9 +105,10 @@ private:
class AbstractMetaAttributes
{
- Q_DISABLE_COPY(AbstractMetaAttributes)
Q_GADGET
public:
+ Q_DISABLE_COPY(AbstractMetaAttributes)
+
AbstractMetaAttributes();
virtual ~AbstractMetaAttributes();
@@ -292,7 +293,7 @@ class AbstractMetaType
{
Q_GADGET
public:
- typedef QVector<Indirection> Indirections;
+ using Indirections = QVector<Indirection>;
enum TypeUsagePattern {
InvalidPattern,
@@ -587,13 +588,12 @@ public:
}
void setType(AbstractMetaType *type)
{
- Q_ASSERT(m_type == 0);
+ Q_ASSERT(m_type == nullptr);
m_type = type;
}
void replaceType(AbstractMetaType *type)
{
- if (m_type)
- delete m_type;
+ delete m_type;
m_type = type;
}
@@ -896,14 +896,13 @@ public:
}
void setType(AbstractMetaType *type)
{
- Q_ASSERT(m_type == 0);
+ Q_ASSERT(m_type == nullptr);
m_type = type;
}
void replaceType(AbstractMetaType *type)
{
- if (m_type)
- delete m_type;
+ delete m_type;
m_type = type;
}
@@ -1053,12 +1052,12 @@ public:
* \return true if there is some modification to function signature
*/
bool hasSignatureModifications() const;
- FunctionModificationList modifications(const AbstractMetaClass* implementor = 0) const;
+ FunctionModificationList modifications(const AbstractMetaClass* implementor = nullptr) const;
/**
* Return the argument name if there is a modification the renamed value will be returned
*/
- QString argumentName(int index, bool create = true, const AbstractMetaClass *cl = 0) const;
+ QString argumentName(int index, bool create = true, const AbstractMetaClass *cl = nullptr) const;
void setPropertySpec(QPropertySpec *spec)
{
@@ -1132,7 +1131,7 @@ QDebug operator<<(QDebug d, const AbstractMetaFunction *af);
class AbstractMetaEnumValue
{
public:
- AbstractMetaEnumValue() {}
+ AbstractMetaEnumValue() = default;
EnumValue value() const
{
@@ -1507,7 +1506,7 @@ public:
m_innerClasses << cl;
}
- void setInnerClasses(AbstractMetaClassList innerClasses)
+ void setInnerClasses(const AbstractMetaClassList &innerClasses)
{
m_innerClasses = innerClasses;
}
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h b/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h
index 9ff11d44..617ebcf4 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h
@@ -39,13 +39,13 @@ class AbstractMetaEnumValue;
class AbstractMetaFunction;
class AbstractMetaType;
-typedef QVector<AbstractMetaArgument *> AbstractMetaArgumentList;
-typedef QVector<AbstractMetaClass *> AbstractMetaClassList;
-typedef QVector<AbstractMetaEnum *> AbstractMetaEnumList;
-typedef QVector<AbstractMetaEnumValue *> AbstractMetaEnumValueList;
-typedef QVector<AbstractMetaField *> AbstractMetaFieldList;
-typedef QVector<AbstractMetaFunction *> AbstractMetaFunctionList;
-typedef QVector<AbstractMetaType *> AbstractMetaTypeList;
-typedef QVector<const AbstractMetaType *> AbstractMetaTypeCList;
+using AbstractMetaArgumentList = QVector<AbstractMetaArgument *>;
+using AbstractMetaClassList = QVector<AbstractMetaClass *>;
+using AbstractMetaEnumList = QVector<AbstractMetaEnum *>;
+using AbstractMetaEnumValueList = QVector<AbstractMetaEnumValue *>;
+using AbstractMetaFieldList = QVector<AbstractMetaField *>;
+using AbstractMetaFunctionList = QVector<AbstractMetaFunction *>;
+using AbstractMetaTypeList = QVector<AbstractMetaType *>;
+using AbstractMetaTypeCList = QVector<const AbstractMetaType *>;
#endif // ABSTRACTMETALANG_TYPEDEFS_H
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.cpp b/sources/shiboken2/ApiExtractor/apiextractor.cpp
index fbe7664e..78fa9e31 100644
--- a/sources/shiboken2/ApiExtractor/apiextractor.cpp
+++ b/sources/shiboken2/ApiExtractor/apiextractor.cpp
@@ -43,7 +43,7 @@
#include "typedatabase.h"
#include "typesystem.h"
-ApiExtractor::ApiExtractor() : m_builder(0)
+ApiExtractor::ApiExtractor()
{
// Environment TYPESYSTEMPATH
QString envTypesystemPaths = QFile::decodeName(qgetenv("TYPESYSTEMPATH"));
@@ -116,7 +116,7 @@ void ApiExtractor::setSilent ( bool value )
bool ApiExtractor::setApiVersion(const QString& package, const QString &version)
{
- return TypeDatabase::instance()->setApiVersion(package, version);
+ return TypeDatabase::setApiVersion(package, version);
}
void ApiExtractor::setDropTypeEntries(QString dropEntries)
@@ -168,7 +168,7 @@ ContainerTypeEntryList ApiExtractor::containerTypes() const
static const AbstractMetaEnum* findEnumOnClasses(AbstractMetaClassList metaClasses, const EnumTypeEntry* typeEntry)
{
- const AbstractMetaEnum* result = 0;
+ const AbstractMetaEnum *result = nullptr;
for (const AbstractMetaClass* metaClass : qAsConst(metaClasses)) {
const AbstractMetaEnumList &enums = metaClass->enums();
for (const AbstractMetaEnum *metaEnum : enums) {
@@ -247,7 +247,7 @@ LanguageLevel ApiExtractor::languageLevel() const
return m_languageLevel;
}
-void ApiExtractor::setLanguageLevel(const LanguageLevel languageLevel)
+void ApiExtractor::setLanguageLevel(LanguageLevel languageLevel)
{
m_languageLevel = languageLevel;
}
@@ -256,13 +256,11 @@ void ApiExtractor::setLanguageLevel(const LanguageLevel languageLevel)
template <class Container>
static void debugFormatSequence(QDebug &d, const char *key, const Container& c)
{
- typedef typename Container::const_iterator ConstIt;
if (c.isEmpty())
return;
- const ConstIt begin = c.begin();
- const ConstIt end = c.end();
+ const auto begin = c.begin();
d << "\n " << key << '[' << c.size() << "]=(";
- for (ConstIt it = begin; it != end; ++it) {
+ for (auto it = begin, end = c.end(); it != end; ++it) {
if (it != begin)
d << ", ";
d << *it;
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.h b/sources/shiboken2/ApiExtractor/apiextractor.h
index 3eb90e74..c8f50f2a 100644
--- a/sources/shiboken2/ApiExtractor/apiextractor.h
+++ b/sources/shiboken2/ApiExtractor/apiextractor.h
@@ -58,6 +58,8 @@ QT_END_NAMESPACE
class ApiExtractor
{
public:
+ Q_DISABLE_COPY(ApiExtractor)
+
ApiExtractor();
~ApiExtractor();
@@ -78,7 +80,7 @@ public:
bool setApiVersion(const QString& package, const QString& version);
void setDropTypeEntries(QString dropEntries);
LanguageLevel languageLevel() const;
- void setLanguageLevel(const LanguageLevel languageLevel);
+ void setLanguageLevel(LanguageLevel languageLevel);
AbstractMetaEnumList globalEnums() const;
AbstractMetaFunctionList globalFunctions() const;
@@ -97,17 +99,15 @@ private:
QString m_typeSystemFileName;
QString m_cppFileName;
HeaderPaths m_includePaths;
- AbstractMetaBuilder* m_builder;
+ AbstractMetaBuilder* m_builder = nullptr;
QString m_logDirectory;
LanguageLevel m_languageLevel = LanguageLevel::Default;
bool m_skipDeprecated = false;
- // disable copy
- ApiExtractor(const ApiExtractor&);
- ApiExtractor& operator=(const ApiExtractor&);
#ifndef QT_NO_DEBUG_STREAM
friend QDebug operator<<(QDebug d, const ApiExtractor &ae);
#endif
};
#endif // APIEXTRACTOR_H
+
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index 3ced0e06..8d1b4deb 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -144,9 +144,9 @@ static bool isSigned(CXTypeKind kind)
class BuilderPrivate {
public:
- typedef QHash<CXCursor, ClassModelItem> CursorClassHash;
- typedef QHash<CXCursor, TypeDefModelItem> CursorTypedefHash;
- typedef QHash<CXType, TypeInfo> TypeInfoHash;
+ using CursorClassHash = QHash<CXCursor, ClassModelItem>;
+ using CursorTypedefHash = QHash<CXCursor, TypeDefModelItem>;
+ using TypeInfoHash = QHash<CXType, TypeInfo>;
explicit BuilderPrivate(BaseVisitor *bv) : m_baseVisitor(bv), m_model(new CodeModel)
{
@@ -645,11 +645,9 @@ static inline CXCursor definitionFromTypeRef(const CXCursor &typeRefCursor)
template <class Item> // ArgumentModelItem, VariableModelItem
void BuilderPrivate::qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const
{
- typedef typename CursorTypedefHash::const_iterator ConstIt;
-
TypeInfo type = item->type();
if (type.qualifiedName().size() == 1) { // item's type is unqualified.
- const ConstIt it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor));
+ const auto it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor));
if (it != m_cursorTypedefHash.constEnd() && !it.value()->scope().isEmpty()) {
type.setQualifiedName(it.value()->scope() + type.qualifiedName());
item->setType(type);
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h
index 2c4dd0e0..fa79acb2 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h
@@ -39,6 +39,8 @@ class BuilderPrivate;
class Builder : public BaseVisitor {
public:
+ Q_DISABLE_COPY(Builder)
+
Builder();
~Builder();
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/clangparser/clangparser.h b/sources/shiboken2/ApiExtractor/clangparser/clangparser.h
index 36b9e0bd..4248be85 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.h
@@ -43,12 +43,12 @@ struct Diagnostic;
class SourceFileCache {
public:
- typedef QPair<const char *, const char *> Snippet;
+ using Snippet = QPair<const char *, const char *>;
Snippet getCodeSnippet(const CXCursor &cursor);
private:
- typedef QHash<QString, QByteArray> FileBufferCache;
+ using FileBufferCache = QHash<QString, QByteArray>;
FileBufferCache m_fileBufferCache;
};
@@ -56,8 +56,8 @@ private:
class BaseVisitor {
Q_DISABLE_COPY(BaseVisitor)
public:
- typedef QVector<Diagnostic> Diagnostics;
- typedef SourceFileCache::Snippet CodeSnippet;
+ using Diagnostics = QVector<Diagnostic>;
+ using CodeSnippet = SourceFileCache::Snippet;
enum StartTokenResult { Error, Skip, Recurse };
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
index db2db626..738b51bb 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
@@ -73,7 +73,7 @@ struct SourceLocation
SourceLocation getExpansionLocation(const CXSourceLocation &location);
-typedef QPair<SourceLocation, SourceLocation> SourceRange;
+using SourceRange =QPair<SourceLocation, SourceLocation>;
SourceLocation getCursorLocation(const CXCursor &cursor);
CXString getFileNameFromLocation(const CXSourceLocation &location);
@@ -82,7 +82,7 @@ SourceRange getCursorRange(const CXCursor &cursor);
struct Diagnostic {
enum Source { Clang, Other };
- Diagnostic() : source(Clang) {}
+ Diagnostic() = default;
// Clang
static Diagnostic fromCXDiagnostic(CXDiagnostic cd);
// Other
@@ -91,8 +91,8 @@ struct Diagnostic {
QString message;
QStringList childMessages;
SourceLocation location;
- Source source;
- CXDiagnosticSeverity severity;
+ Source source = Clang;
+ CXDiagnosticSeverity severity = CXDiagnostic_Warning;
};
QVector<Diagnostic> getDiagnostics(CXTranslationUnit tu);
@@ -100,7 +100,7 @@ CXDiagnosticSeverity maxSeverity(const QVector<Diagnostic> &ds);
// Parse a template argument list "a<b<c,d>,e>" and invoke a handler
// with each match (level and string). Return begin and end of the list.
-typedef std::function<void(int /*level*/, const QStringRef &)> TemplateArgumentHandler;
+using TemplateArgumentHandler = std::function<void (int, const QStringRef &)>;
QPair<int, int> parseTemplateArgumentList(const QString &l,
const TemplateArgumentHandler &handler,
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index 3196c824..f301733f 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -291,10 +291,11 @@ static QString findClangBuiltInIncludesDir()
#if defined(Q_CC_CLANG) || defined(Q_CC_GNU)
static QString compilerFromCMake(const QString &defaultCompiler)
{
-# ifdef CMAKE_CXX_COMPILER
+// Added !defined(Q_OS_DARWIN) due to PYSIDE-1032
+# if defined(CMAKE_CXX_COMPILER) && !defined(Q_OS_DARWIN)
Q_UNUSED(defaultCompiler)
return QString::fromLocal8Bit(CMAKE_CXX_COMPILER);
-#else
+# else
return defaultCompiler;
# endif
}
diff --git a/sources/shiboken2/ApiExtractor/dependency.h b/sources/shiboken2/ApiExtractor/dependency.h
index d563e909..7168ea3b 100644
--- a/sources/shiboken2/ApiExtractor/dependency.h
+++ b/sources/shiboken2/ApiExtractor/dependency.h
@@ -42,6 +42,6 @@ struct Dependency {
AbstractMetaClass *child;
};
-typedef QVector<Dependency> Dependencies;
+using Dependencies = QVector<Dependency>;
#endif // DEPENDENCY_H
diff --git a/sources/shiboken2/ApiExtractor/docparser.h b/sources/shiboken2/ApiExtractor/docparser.h
index 53507b0f..1dccae4d 100644
--- a/sources/shiboken2/ApiExtractor/docparser.h
+++ b/sources/shiboken2/ApiExtractor/docparser.h
@@ -43,6 +43,8 @@ class XQuery;
class DocParser
{
public:
+ Q_DISABLE_COPY(DocParser)
+
using XQueryPtr = QSharedPointer<XQuery>;
DocParser();
diff --git a/sources/shiboken2/ApiExtractor/doxygenparser.h b/sources/shiboken2/ApiExtractor/doxygenparser.h
index ed3a7bf0..ada64ac1 100644
--- a/sources/shiboken2/ApiExtractor/doxygenparser.h
+++ b/sources/shiboken2/ApiExtractor/doxygenparser.h
@@ -34,7 +34,7 @@
class DoxygenParser : public DocParser
{
public:
- DoxygenParser() {}
+ DoxygenParser() = default;
void fillDocumentation(AbstractMetaClass *metaClass) override;
Documentation retrieveModuleDocumentation() override;
Documentation retrieveModuleDocumentation(const QString& name) override;
diff --git a/sources/shiboken2/ApiExtractor/fileout.h b/sources/shiboken2/ApiExtractor/fileout.h
index aace7013..b1011c4d 100644
--- a/sources/shiboken2/ApiExtractor/fileout.h
+++ b/sources/shiboken2/ApiExtractor/fileout.h
@@ -41,6 +41,8 @@ private:
QString name;
public:
+ Q_DISABLE_COPY(FileOut)
+
enum State { Failure, Unchanged, Success };
explicit FileOut(QString name);
diff --git a/sources/shiboken2/ApiExtractor/graph.cpp b/sources/shiboken2/ApiExtractor/graph.cpp
index c2ac81e6..95a80197 100644
--- a/sources/shiboken2/ApiExtractor/graph.cpp
+++ b/sources/shiboken2/ApiExtractor/graph.cpp
@@ -38,8 +38,7 @@
struct Graph::GraphPrivate
{
enum Color { WHITE, GRAY, BLACK };
- typedef QVector<QSet<int> > Edges;
- typedef QSet<int>::const_iterator EdgeIterator;
+ using Edges = QVector<QSet<int> >;
Edges edges;
@@ -50,11 +49,10 @@ struct Graph::GraphPrivate
void dfsVisit(int node, Graph::Indexes &result, QVector<Color> &colors) const
{
colors[node] = GRAY;
- EdgeIterator it = edges[node].begin();
- for (; it != edges[node].end(); ++it) {
- if (colors[*it] == WHITE)
- dfsVisit(*it, result, colors);
- else if (colors[*it] == GRAY) // This is not a DAG!
+ for (const auto &c : edges.at(node)) {
+ if (colors[c] == WHITE)
+ dfsVisit(c, result, colors);
+ else if (colors[c] == GRAY) // This is not a DAG!
return;
}
colors[node] = BLACK;
diff --git a/sources/shiboken2/ApiExtractor/graph.h b/sources/shiboken2/ApiExtractor/graph.h
index 043a182b..5dc8e21e 100644
--- a/sources/shiboken2/ApiExtractor/graph.h
+++ b/sources/shiboken2/ApiExtractor/graph.h
@@ -37,6 +37,8 @@
class Graph
{
public:
+ Q_DISABLE_COPY(Graph)
+
using Indexes = QVector<int>;
/// Create a new graph with \p numNodes nodes.
diff --git a/sources/shiboken2/ApiExtractor/header_paths.h b/sources/shiboken2/ApiExtractor/header_paths.h
index 01d83092..0c25702e 100644
--- a/sources/shiboken2/ApiExtractor/header_paths.h
+++ b/sources/shiboken2/ApiExtractor/header_paths.h
@@ -67,6 +67,6 @@ public:
}
};
-typedef QList<HeaderPath> HeaderPaths;
+using HeaderPaths = QList<HeaderPath>;
#endif // HEADER_PATHS_H
diff --git a/sources/shiboken2/ApiExtractor/include.h b/sources/shiboken2/ApiExtractor/include.h
index 4890eea2..f7dfea5a 100644
--- a/sources/shiboken2/ApiExtractor/include.h
+++ b/sources/shiboken2/ApiExtractor/include.h
@@ -46,7 +46,7 @@ public:
InvalidInclude
};
- Include() : m_type(IncludePath) {}
+ Include() = default;
Include(IncludeType t, const QString &nam) : m_type(t), m_name(nam) {};
bool isValid() const
@@ -78,7 +78,7 @@ public:
friend uint qHash(const Include&);
private:
- IncludeType m_type;
+ IncludeType m_type = IncludePath;
QString m_name;
};
@@ -88,6 +88,6 @@ QTextStream& operator<<(QTextStream& out, const Include& include);
QDebug operator<<(QDebug d, const Include &i);
#endif
-typedef QVector<Include> IncludeList;
+using IncludeList = QVector<Include>;
#endif
diff --git a/sources/shiboken2/ApiExtractor/merge.xsl b/sources/shiboken2/ApiExtractor/merge.xsl
index d0b7eafa..c6cab5a4 100644
--- a/sources/shiboken2/ApiExtractor/merge.xsl
+++ b/sources/shiboken2/ApiExtractor/merge.xsl
@@ -2,11 +2,11 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
- <xsl:param name="lang" />
- <xsl:param name="source" />
+ <xsl:param name="lang" />
+ <xsl:param name="source" />
<xsl:template match="processing-instruction()" />
-
+
<xsl:template match="/typesystem">
<xsl:copy>
<xsl:for-each select="@*">
@@ -20,8 +20,8 @@
<xsl:value-of select="." />
</xsl:copy>
</xsl:for-each>
-
- <xsl:variable name="other" select="document($source)/typesystem/*[not(self::object-type | self::value-type | self::interface-type | self::namespace-type)]" />
+
+ <xsl:variable name="other" select="document($source)/typesystem/*[not(self::object-type | self::value-type | self::interface-type | self::namespace-type)]" />
<xsl:if test="$other">
<xsl:choose>
<xsl:when test="$lang != ''">
@@ -37,7 +37,7 @@
</xsl:if>
<xsl:apply-templates select="node()" />
-
+
</xsl:copy>
</xsl:template>
@@ -53,14 +53,14 @@
</xsl:for-each>
<xsl:apply-templates select="node()" />
-
+
<xsl:variable name="other" select="document($source)/typesystem/*[name() = $name][@name = current()/@name]" />
<xsl:if test="$other">
<xsl:choose>
<xsl:when test="$lang != ''">
<xsl:element name="language">
<xsl:attribute name="name" ><xsl:value-of select="$lang" /></xsl:attribute>
- <xsl:copy-of select="$other/node()" />
+ <xsl:copy-of select="$other/node()" />
</xsl:element>
</xsl:when>
<xsl:otherwise>
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
index 7bb7e0a8..099ab886 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
@@ -53,9 +53,8 @@ private:
template <class T>
static QSharedPointer<T> findModelItem(const QVector<QSharedPointer<T> > &list, const QString &name)
{
- typedef typename QVector<QSharedPointer<T> >::const_iterator It;
- const It it = std::find_if(list.begin(), list.end(), ModelItemNamePredicate<T>(name));
- return it != list.end() ? *it : QSharedPointer<T>();
+ const auto it = std::find_if(list.cbegin(), list.cend(), ModelItemNamePredicate<T>(name));
+ return it != list.cend() ? *it : QSharedPointer<T>();
}
// ---------------------------------------------------------------------------
@@ -64,16 +63,14 @@ CodeModel::CodeModel() : m_globalNamespace(new _NamespaceModelItem(this))
{
}
-CodeModel::~CodeModel()
-{
-}
+CodeModel::~CodeModel() = default;
NamespaceModelItem CodeModel::globalNamespace() const
{
return m_globalNamespace;
}
-void CodeModel::addFile(FileModelItem item)
+void CodeModel::addFile(const FileModelItem &item)
{
m_files.append(item);
}
@@ -161,7 +158,7 @@ bool TypeInfo::isVoid() const
TypeInfo TypeInfo::resolveType(TypeInfo const &__type, const ScopeModelItem &__scope)
{
CodeModel *__model = __scope->model();
- Q_ASSERT(__model != 0);
+ Q_ASSERT(__model != nullptr);
return TypeInfo::resolveType(__model->findItem(__type.qualifiedName(), __scope), __type, __scope);
}
@@ -724,7 +721,7 @@ static void formatModelItemList(QDebug &d, const char *prefix, const List &l,
void _ClassModelItem::formatDebug(QDebug &d) const
{
- _CodeModelItem::formatDebug(d);
+ _ScopeModelItem::formatDebug(d);
if (!m_baseClasses.isEmpty()) {
if (m_final)
d << " [final]";
@@ -742,7 +739,7 @@ void _ClassModelItem::formatDebug(QDebug &d) const
#endif // !QT_NO_DEBUG_STREAM
// ---------------------------------------------------------------------------
-FunctionModelItem _ScopeModelItem::declaredFunction(FunctionModelItem item)
+FunctionModelItem _ScopeModelItem::declaredFunction(const FunctionModelItem &item)
{
for (const FunctionModelItem &fun : qAsConst(m_functions)) {
if (fun->name() == item->name() && fun->isSimilar(item))
@@ -759,27 +756,27 @@ void _ScopeModelItem::addEnumsDeclaration(const QString &enumsDeclaration)
m_enumsDeclarations << enumsDeclaration;
}
-void _ScopeModelItem::addClass(ClassModelItem item)
+void _ScopeModelItem::addClass(const ClassModelItem &item)
{
m_classes.append(item);
}
-void _ScopeModelItem::addFunction(FunctionModelItem item)
+void _ScopeModelItem::addFunction(const FunctionModelItem &item)
{
m_functions.append(item);
}
-void _ScopeModelItem::addVariable(VariableModelItem item)
+void _ScopeModelItem::addVariable(const VariableModelItem &item)
{
m_variables.append(item);
}
-void _ScopeModelItem::addTypeDef(TypeDefModelItem item)
+void _ScopeModelItem::addTypeDef(const TypeDefModelItem &item)
{
m_typeDefs.append(item);
}
-void _ScopeModelItem::addEnum(EnumModelItem item)
+void _ScopeModelItem::addEnum(const EnumModelItem &item)
{
m_enums.append(item);
}
@@ -800,12 +797,10 @@ static void formatScopeHash(QDebug &d, const char *prefix, const Hash &h,
const char *separator = ", ",
bool trailingNewLine = false)
{
- typedef typename Hash::ConstIterator HashIterator;
if (!h.isEmpty()) {
d << prefix << '[' << h.size() << "](";
- const HashIterator begin = h.begin();
- const HashIterator end = h.end();
- for (HashIterator it = begin; it != end; ++it) { // Omit the names as they are repeated
+ const auto begin = h.cbegin();
+ for (auto it = begin, end = h.cend(); it != end; ++it) { // Omit the names as they are repeated
if (it != begin)
d << separator;
d << it.value().data();
@@ -916,9 +911,7 @@ NamespaceModelItem _NamespaceModelItem::findNamespace(const QString &name) const
return findModelItem(m_namespaces, name);
}
-_FileModelItem::~_FileModelItem()
-{
-}
+_FileModelItem::~_FileModelItem() = default;
void _NamespaceModelItem::appendNamespace(const _NamespaceModelItem &other)
{
@@ -1188,9 +1181,7 @@ CodeModel::AccessPolicy _EnumModelItem::accessPolicy() const
return m_accessPolicy;
}
-_EnumModelItem::~_EnumModelItem()
-{
-}
+_EnumModelItem::~_EnumModelItem() = default;
void _EnumModelItem::setAccessPolicy(CodeModel::AccessPolicy accessPolicy)
{
@@ -1202,7 +1193,7 @@ EnumeratorList _EnumModelItem::enumerators() const
return m_enumerators;
}
-void _EnumModelItem::addEnumerator(EnumeratorModelItem item)
+void _EnumModelItem::addEnumerator(const EnumeratorModelItem &item)
{
m_enumerators.append(item);
}
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h
index 6f3c1761..777b2d10 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.h
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h
@@ -50,6 +50,8 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
class CodeModel
{
public:
+ Q_DISABLE_COPY(CodeModel)
+
enum AccessPolicy {
Public,
Protected,
@@ -79,7 +81,7 @@ public:
FileList files() const { return m_files; }
NamespaceModelItem globalNamespace() const;
- void addFile(FileModelItem item);
+ void addFile(const FileModelItem &item);
FileModelItem findFile(const QString &name) const;
CodeModelItem findItem(const QStringList &qualifiedName, const ScopeModelItem &scope) const;
@@ -87,10 +89,6 @@ public:
private:
FileList m_files;
NamespaceModelItem m_globalNamespace;
-
-private:
- CodeModel(const CodeModel &other);
- void operator = (const CodeModel &other);
};
#ifndef QT_NO_DEBUG_STREAM
@@ -101,7 +99,7 @@ class TypeInfo
{
friend class TypeParser;
public:
- typedef QVector<Indirection> Indirections;
+ using Indirections = QVector<Indirection>;
TypeInfo() : flags(0), m_referenceType(NoReference) {}
@@ -334,11 +332,11 @@ public:
TypeDefList typeDefs() const { return m_typeDefs; }
VariableList variables() const { return m_variables; }
- void addClass(ClassModelItem item);
- void addEnum(EnumModelItem item);
- void addFunction(FunctionModelItem item);
- void addTypeDef(TypeDefModelItem item);
- void addVariable(VariableModelItem item);
+ void addClass(const ClassModelItem &item);
+ void addEnum(const EnumModelItem &item);
+ void addFunction(const FunctionModelItem &item);
+ void addTypeDef(const TypeDefModelItem &item);
+ void addVariable(const VariableModelItem &item);
ClassModelItem findClass(const QString &name) const;
EnumModelItem findEnum(const QString &name) const;
@@ -349,7 +347,7 @@ public:
void addEnumsDeclaration(const QString &enumsDeclaration);
QStringList enumsDeclarations() const { return m_enumsDeclarations; }
- FunctionModelItem declaredFunction(FunctionModelItem item);
+ FunctionModelItem declaredFunction(const FunctionModelItem &item);
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &d) const override;
@@ -692,7 +690,7 @@ public:
bool hasValues() const { return !m_enumerators.isEmpty(); }
EnumeratorList enumerators() const;
- void addEnumerator(EnumeratorModelItem item);
+ void addEnumerator(const EnumeratorModelItem &item);
EnumKind enumKind() const { return m_enumKind; }
void setEnumKind(EnumKind kind) { m_enumKind = kind; }
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h b/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h
index f67c6422..54dbe78d 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h
@@ -51,32 +51,32 @@ class _VariableModelItem;
class _MemberModelItem;
class TypeInfo;
-typedef QSharedPointer<_ArgumentModelItem> ArgumentModelItem;
-typedef QSharedPointer<_ClassModelItem> ClassModelItem;
-typedef QSharedPointer<_CodeModelItem> CodeModelItem;
-typedef QSharedPointer<_EnumModelItem> EnumModelItem;
-typedef QSharedPointer<_EnumeratorModelItem> EnumeratorModelItem;
-typedef QSharedPointer<_FileModelItem> FileModelItem;
-typedef QSharedPointer<_FunctionModelItem> FunctionModelItem;
-typedef QSharedPointer<_NamespaceModelItem> NamespaceModelItem;
-typedef QSharedPointer<_ScopeModelItem> ScopeModelItem;
-typedef QSharedPointer<_TemplateParameterModelItem> TemplateParameterModelItem;
-typedef QSharedPointer<_TypeDefModelItem> TypeDefModelItem;
-typedef QSharedPointer<_VariableModelItem> VariableModelItem;
-typedef QSharedPointer<_MemberModelItem> MemberModelItem;
+using ArgumentModelItem = QSharedPointer<_ArgumentModelItem>;
+using ClassModelItem = QSharedPointer<_ClassModelItem>;
+using CodeModelItem = QSharedPointer<_CodeModelItem>;
+using EnumModelItem = QSharedPointer<_EnumModelItem>;
+using EnumeratorModelItem = QSharedPointer<_EnumeratorModelItem>;
+using FileModelItem = QSharedPointer<_FileModelItem>;
+using FunctionModelItem = QSharedPointer<_FunctionModelItem>;
+using NamespaceModelItem = QSharedPointer<_NamespaceModelItem>;
+using ScopeModelItem = QSharedPointer<_ScopeModelItem>;
+using TemplateParameterModelItem = QSharedPointer<_TemplateParameterModelItem>;
+using TypeDefModelItem = QSharedPointer<_TypeDefModelItem>;
+using VariableModelItem = QSharedPointer<_VariableModelItem>;
+using MemberModelItem = QSharedPointer<_MemberModelItem>;
-typedef QVector<ArgumentModelItem> ArgumentList;
-typedef QVector<ClassModelItem> ClassList;
-typedef QVector<CodeModelItem> ItemList;
-typedef QVector<EnumModelItem> EnumList;
-typedef QVector<EnumeratorModelItem> EnumeratorList;
-typedef QVector<FileModelItem> FileList;
-typedef QVector<FunctionModelItem> FunctionList;
-typedef QVector<NamespaceModelItem> NamespaceList;
-typedef QVector<ScopeModelItem> ScopeList;
-typedef QVector<TemplateParameterModelItem> TemplateParameterList;
-typedef QVector<TypeDefModelItem> TypeDefList;
-typedef QVector<VariableModelItem> VariableList;
-typedef QVector<MemberModelItem> MemberList;
+using ArgumentList = QVector<ArgumentModelItem>;
+using ClassList = QVector<ClassModelItem>;
+using ItemList = QVector<CodeModelItem>;
+using EnumList = QVector<EnumModelItem>;
+using EnumeratorList = QVector<EnumeratorModelItem>;
+using FileList = QVector<FileModelItem>;
+using FunctionList = QVector<FunctionModelItem>;
+using NamespaceList = QVector<NamespaceModelItem>;
+using ScopeList = QVector<ScopeModelItem>;
+using TemplateParameterList = QVector<TemplateParameterModelItem>;
+using TypeDefList = QVector<TypeDefModelItem>;
+using VariableList = QVector<VariableModelItem>;
+using MemberList = QVector<MemberModelItem>;
#endif // CODEMODEL_FWD_H
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.cpp b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
index c5ee1743..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(':'));
@@ -212,7 +212,7 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass)
const AbstractMetaClass* context = metaClass->enclosingClass();
while(context) {
- if (context->enclosingClass() == 0)
+ if (context->enclosingClass() == nullptr)
break;
context = context->enclosingClass();
}
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.h b/sources/shiboken2/ApiExtractor/qtdocparser.h
index c4333e82..b01139de 100644
--- a/sources/shiboken2/ApiExtractor/qtdocparser.h
+++ b/sources/shiboken2/ApiExtractor/qtdocparser.h
@@ -34,7 +34,7 @@
class QtDocParser : public DocParser
{
public:
- QtDocParser() {}
+ QtDocParser() = default;
void fillDocumentation(AbstractMetaClass* metaClass) override;
Documentation retrieveModuleDocumentation() override;
Documentation retrieveModuleDocumentation(const QString& name) override;
diff --git a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp
index 8a6b5928..98b493c6 100644
--- a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp
@@ -134,7 +134,7 @@ public:
const AbstractMetaClass *f = AbstractMetaClass::findClass(classes, QLatin1String("F"));
QVERIFY(f);
- AbstractMetaClass* no_class = 0;
+ AbstractMetaClass* no_class = nullptr;
QCOMPARE(a->baseClass(), no_class);
QCOMPARE(b->baseClass(), a);
diff --git a/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp b/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp
index 67865d3a..142c783a 100644
--- a/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp
@@ -64,7 +64,7 @@ void TestConversionOperator::testConversionOperator()
QCOMPARE(classC->functions().count(), 3);
QCOMPARE(classA->externalConversionOperators().count(), 2);
- AbstractMetaFunction* convOp = 0;
+ AbstractMetaFunction *convOp = nullptr;
for (AbstractMetaFunction *func : classB->functions()) {
if (func->isConversionOperator()) {
convOp = func;
diff --git a/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp b/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp
index 8c662d76..aa2bec5d 100644
--- a/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp
@@ -119,7 +119,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace()
QVERIFY(toNative);
QCOMPARE(toNative->sourceTypeName(), QLatin1String("TargetNone"));
QVERIFY(toNative->isCustomType());
- QCOMPARE(toNative->sourceType(), (const TypeEntry*)0);
+ QCOMPARE(toNative->sourceType(), nullptr);
QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("%IN == Target_None"));
QCOMPARE(toNative->conversion().simplified(),
QLatin1String("DoThat(); DoSomething(); %OUT = A();"));
@@ -138,7 +138,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace()
QVERIFY(toNative);
QCOMPARE(toNative->sourceTypeName(), QLatin1String("String"));
QVERIFY(toNative->isCustomType());
- QCOMPARE(toNative->sourceType(), (const TypeEntry*)0);
+ QCOMPARE(toNative->sourceType(), nullptr);
QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("String_Check(%IN)"));
QCOMPARE(toNative->conversion().trimmed(), QLatin1String("%OUT = new A(String_AsString(%IN), String_GetSize(%IN));"));
}
@@ -183,7 +183,7 @@ if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n\
QVERIFY(toNative);
QCOMPARE(toNative->sourceTypeName(), QLatin1String("TargetDate"));
QVERIFY(toNative->isCustomType());
- QCOMPARE(toNative->sourceType(), (const TypeEntry*)0);
+ QCOMPARE(toNative->sourceType(), nullptr);
QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("TargetDate_Check(%IN)"));
QCOMPARE(toNative->conversion().trimmed(),
QLatin1String("if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n%OUT = new Date(TargetDate_Day(%IN), TargetDate_Month(%IN), TargetDate_Year(%IN));"));
diff --git a/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp b/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp
index 7b3616da..26fb148d 100644
--- a/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp
@@ -151,7 +151,7 @@ void TestImplicitConversions::testWithExternalConversionOperator()
AbstractMetaFunctionList externalConvOps = classA->externalConversionOperators();
QCOMPARE(externalConvOps.count(), 1);
- const AbstractMetaFunction* convOp = 0;
+ const AbstractMetaFunction *convOp = nullptr;
for (const AbstractMetaFunction *func : classB->functions()) {
if (func->isConversionOperator())
convOp = func;
diff --git a/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp b/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp
index 2ea95595..dc4801e1 100644
--- a/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp
@@ -51,7 +51,7 @@ void TestReverseOperators::testReverseSum()
QVERIFY(classA);
QCOMPARE(classA->functions().count(), 4);
- const AbstractMetaFunction* reverseOp = 0;
+ const AbstractMetaFunction* reverseOp = nullptr;
const AbstractMetaFunction* normalOp = 0;
for (const AbstractMetaFunction *func : classA->functions()) {
if (func->name() == QLatin1String("operator+")) {
@@ -100,8 +100,8 @@ void TestReverseOperators::testReverseSumWithAmbiguity()
QVERIFY(classB);
QCOMPARE(classB->functions().count(), 4);
- const AbstractMetaFunction* reverseOp = 0;
- const AbstractMetaFunction* normalOp = 0;
+ const AbstractMetaFunction *reverseOp = nullptr;
+ const AbstractMetaFunction *normalOp = nullptr;
for (const AbstractMetaFunction *func : classB->functions()) {
if (func->name() == QLatin1String("operator+")) {
if (func->isReverseOperator())
diff --git a/sources/shiboken2/ApiExtractor/tests/testutil.h b/sources/shiboken2/ApiExtractor/tests/testutil.h
index c6ad19d7..9a2faad5 100644
--- a/sources/shiboken2/ApiExtractor/tests/testutil.h
+++ b/sources/shiboken2/ApiExtractor/tests/testutil.h
@@ -47,7 +47,7 @@ namespace TestUtil
TypeDatabase* td = TypeDatabase::instance(true);
if (apiVersion.isEmpty())
TypeDatabase::clearApiVersions();
- else if (!td->setApiVersion(QLatin1String("*"), apiVersion))
+ else if (!TypeDatabase::setApiVersion(QLatin1String("*"), apiVersion))
return nullptr;
td->setDropTypeEntries(dropTypeEntries);
QBuffer buffer;
@@ -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 930f85d3..144795c6 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -51,27 +51,24 @@ static QString wildcardToRegExp(QString w)
return w;
}
-typedef QPair<QRegularExpression, QVersionNumber> ApiVersion;
-typedef QVector<ApiVersion> ApiVersions;
+using ApiVersion =QPair<QRegularExpression, QVersionNumber>;
+using ApiVersions = QVector<ApiVersion>;
Q_GLOBAL_STATIC(ApiVersions, apiVersions)
-TypeDatabase::TypeDatabase() : m_suppressWarnings(true)
+TypeDatabase::TypeDatabase()
{
addType(new VoidTypeEntry());
addType(new VarargsTypeEntry());
}
-TypeDatabase::~TypeDatabase()
-{
-}
+TypeDatabase::~TypeDatabase() = default;
TypeDatabase* TypeDatabase::instance(bool newInstance)
{
- static TypeDatabase* db = 0;
+ static TypeDatabase *db = nullptr;
if (!db || newInstance) {
- if (db)
- delete db;
+ delete db;
db = new TypeDatabase;
}
return db;
@@ -85,7 +82,7 @@ struct IntTypeNormalizationEntry
QString replacement;
};
-typedef QVector<IntTypeNormalizationEntry> IntTypeNormalizationEntries;
+using IntTypeNormalizationEntries = QVector<IntTypeNormalizationEntry>;
static const IntTypeNormalizationEntries &intTypeNormalizationEntries()
{
@@ -93,10 +90,8 @@ static const IntTypeNormalizationEntries &intTypeNormalizationEntries()
static bool firstTime = true;
if (firstTime) {
firstTime = false;
- static const char *intTypes[] = {"char", "short", "int", "long"};
- const size_t size = sizeof(intTypes) / sizeof(intTypes[0]);
- for (size_t i = 0; i < size; ++i) {
- const QString intType = QLatin1String(intTypes[i]);
+ for (auto t : {"char", "short", "int", "long"}) {
+ const QString intType = QLatin1String(t);
if (!TypeDatabase::instance()->findType(QLatin1Char('u') + intType)) {
IntTypeNormalizationEntry entry;
entry.replacement = QStringLiteral("unsigned ") + intType;
@@ -115,8 +110,8 @@ QString TypeDatabase::normalizedSignature(const QString &signature)
if (instance() && signature.contains(QLatin1String("unsigned"))) {
const IntTypeNormalizationEntries &entries = intTypeNormalizationEntries();
- for (int i = 0, size = entries.size(); i < size; ++i)
- normalized.replace(entries.at(i).regex, entries.at(i).replacement);
+ for (const auto &entry : entries)
+ normalized.replace(entry.regex, entry.replacement);
}
return normalized;
@@ -146,10 +141,7 @@ void TypeDatabase::addTypesystemPath(const QString& typesystem_paths)
IncludeList TypeDatabase::extraIncludes(const QString& className) const
{
ComplexTypeEntry* typeEntry = findComplexType(className);
- if (typeEntry)
- return typeEntry->extraIncludes();
- else
- return IncludeList();
+ return typeEntry ? typeEntry->extraIncludes() : IncludeList();
}
ContainerTypeEntry* TypeDatabase::findContainerType(const QString &name) const
@@ -163,7 +155,7 @@ ContainerTypeEntry* TypeDatabase::findContainerType(const QString &name) const
TypeEntry* type_entry = findType(template_name);
if (type_entry && type_entry->isContainer())
return static_cast<ContainerTypeEntry*>(type_entry);
- return 0;
+ return nullptr;
}
static bool inline useType(const TypeEntry *t)
@@ -179,7 +171,7 @@ FunctionTypeEntry* TypeDatabase::findFunctionType(const QString& name) const
if (entry->type() == TypeEntry::FunctionType && useType(entry))
return static_cast<FunctionTypeEntry*>(entry);
}
- return 0;
+ return nullptr;
}
void TypeDatabase::addTypeSystemType(const TypeSystemTypeEntry *e)
@@ -351,7 +343,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,13 +584,13 @@ 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;
}
}
- return 0;
+ return nullptr;
}
ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const
@@ -608,7 +600,7 @@ ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const
if (entry->isComplex() && useType(entry))
return static_cast<ComplexTypeEntry*>(entry);
}
- return 0;
+ return nullptr;
}
ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const
@@ -618,7 +610,7 @@ ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const
if (entry && entry->isObject() && useType(entry))
return static_cast<ObjectTypeEntry*>(entry);
}
- return 0;
+ return nullptr;
}
NamespaceTypeEntryList TypeDatabase::findNamespaceTypes(const QString& name) const
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index 7f1b2a3f..334e88a1 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -72,30 +72,30 @@ public:
* \param newInstance This parameter is useful just for unit testing, because singletons causes
* too many side effects on unit testing.
*/
- static TypeDatabase* instance(bool newInstance = false);
+ static TypeDatabase *instance(bool newInstance = false);
static QString normalizedSignature(const QString &signature);
QStringList requiredTargetImports() const;
- void addRequiredTargetImport(const QString& moduleName);
+ void addRequiredTargetImport(const QString &moduleName);
- void addTypesystemPath(const QString& typesystem_paths);
+ void addTypesystemPath(const QString &typesystem_paths);
- IncludeList extraIncludes(const QString& className) const;
+ IncludeList extraIncludes(const QString &className) const;
- PrimitiveTypeEntry* findPrimitiveType(const QString& name) const;
- ComplexTypeEntry* findComplexType(const QString& name) const;
- ObjectTypeEntry* findObjectType(const QString& name) const;
- NamespaceTypeEntryList findNamespaceTypes(const QString& name) const;
- NamespaceTypeEntry *findNamespaceType(const QString& name, const QString &fileName = QString()) const;
- ContainerTypeEntry* findContainerType(const QString& name) const;
- FunctionTypeEntry* findFunctionType(const QString& name) const;
+ PrimitiveTypeEntry *findPrimitiveType(const QString &name) const;
+ ComplexTypeEntry *findComplexType(const QString &name) const;
+ ObjectTypeEntry *findObjectType(const QString &name) const;
+ NamespaceTypeEntryList findNamespaceTypes(const QString &name) const;
+ NamespaceTypeEntry *findNamespaceType(const QString &name, const QString &fileName = QString()) const;
+ ContainerTypeEntry *findContainerType(const QString &name) const;
+ FunctionTypeEntry *findFunctionType(const QString &name) const;
const TypeSystemTypeEntry *findTypeSystemType(const QString &name) const;
const TypeSystemTypeEntry *defaultTypeSystemType() const;
QString defaultPackageName() const;
- TypeEntry* findType(const QString& name) const;
+ TypeEntry *findType(const QString &name) const;
const TypeEntryMultiMap &entries() const { return m_entries; }
const TypedefEntryMap &typedefEntries() const { return m_typedefEntries; }
@@ -105,59 +105,59 @@ public:
ContainerTypeEntryList containerTypes() const;
void addRejection(const TypeRejection &);
- bool isClassRejected(const QString& className, QString *reason = nullptr) const;
- bool isFunctionRejected(const QString& className, const QString& functionName,
+ bool isClassRejected(const QString &className, QString *reason = nullptr) const;
+ bool isFunctionRejected(const QString &className, const QString &functionName,
QString *reason = nullptr) const;
- bool isFieldRejected(const QString& className, const QString& fieldName,
+ bool isFieldRejected(const QString &className, const QString &fieldName,
QString *reason = nullptr) const;
- bool isEnumRejected(const QString& className, const QString& enumName,
+ bool isEnumRejected(const QString &className, const QString &enumName,
QString *reason = nullptr) const;
- bool isArgumentTypeRejected(const QString& className, const QString& typeName,
+ bool isArgumentTypeRejected(const QString &className, const QString &typeName,
QString *reason = nullptr) const;
- bool isReturnTypeRejected(const QString& className, const QString& typeName,
+ bool isReturnTypeRejected(const QString &className, const QString &typeName,
QString *reason = nullptr) const;
- bool addType(TypeEntry* e, QString *errorMessage = nullptr);
+ bool addType(TypeEntry *e, QString *errorMessage = nullptr);
void addTypeSystemType(const TypeSystemTypeEntry *e);
- FlagsTypeEntry* findFlagsType(const QString& name) const;
- void addFlagsType(FlagsTypeEntry* fte);
+ FlagsTypeEntry *findFlagsType(const QString &name) const;
+ void addFlagsType(FlagsTypeEntry *fte);
- TemplateEntry *findTemplate(const QString& name) const { return m_templates[name]; }
+ TemplateEntry *findTemplate(const QString &name) const { return m_templates[name]; }
- void addTemplate(TemplateEntry* t);
+ void addTemplate(TemplateEntry *t);
AddedFunctionList globalUserFunctions() const { return m_globalUserFunctions; }
void addGlobalUserFunctions(const AddedFunctionList &functions);
- AddedFunctionList findGlobalUserFunctions(const QString& name) const;
+ AddedFunctionList findGlobalUserFunctions(const QString &name) const;
void addGlobalUserFunctionModifications(const FunctionModificationList &functionModifications);
- FunctionModificationList functionModifications(const QString& signature) const;
+ FunctionModificationList functionModifications(const QString &signature) const;
void setSuppressWarnings(bool on) { m_suppressWarnings = on; }
bool addSuppressedWarning(const QString &warning, QString *errorMessage);
- bool isSuppressedWarning(const QString& s) const;
+ bool isSuppressedWarning(const QString &s) const;
static QString globalNamespaceClassName(const TypeEntry *te);
bool parseFile(const QString &filename, bool generate = true);
bool parseFile(const QString &filename, const QString &currentPath, bool generate);
- bool parseFile(QIODevice* device, bool generate = true);
+ bool parseFile(QIODevice *device, bool generate = true);
- static bool setApiVersion(const QString& package, const QString& version);
+ static bool setApiVersion(const QString &package, const QString &version);
static void clearApiVersions();
static bool checkApiVersion(const QString &package, const QVersionNumber &version);
bool hasDroppedTypeEntries() const { return !m_dropTypeEntries.isEmpty(); }
- bool shouldDropTypeEntry(const QString& fullTypeName) const;
+ bool shouldDropTypeEntry(const QString &fullTypeName) const;
void setDropTypeEntries(QStringList dropTypeEntries);
@@ -170,7 +170,7 @@ private:
TypeEntryMultiMapConstIteratorRange findTypes(const QString &name) const;
TypeEntry *resolveTypeDefEntry(TypedefEntry *typedefEntry, QString *errorMessage);
- bool m_suppressWarnings;
+ bool m_suppressWarnings = true;
TypeEntryMultiMap m_entries;
TypeEntryMap m_flagsEntries;
TypedefEntryMap m_typedefEntries;
diff --git a/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h b/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
index f9591609..0bb5cde1 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
@@ -40,8 +40,8 @@ class TemplateEntry;
class TypeEntry;
class TypedefEntry;
-typedef QVector<TypeEntry *> TypeEntryList;
-typedef QMap<QString, TemplateEntry *> TemplateEntryMap;
+using TypeEntryList = QVector<TypeEntry *>;
+using TemplateEntryMap =QMap<QString, TemplateEntry *>;
template <class Key, class Value>
struct QMultiMapConstIteratorRange // A range of iterator for a range-based for loop
@@ -55,14 +55,14 @@ struct QMultiMapConstIteratorRange // A range of iterator for a range-based for
ConstIterator m_end;
};
-typedef QMultiMap<QString, TypeEntry *> TypeEntryMultiMap;
-typedef QMultiMapConstIteratorRange<QString, TypeEntry *> TypeEntryMultiMapConstIteratorRange;
+using TypeEntryMultiMap = QMultiMap<QString, TypeEntry *>;
+using TypeEntryMultiMapConstIteratorRange = QMultiMapConstIteratorRange<QString, TypeEntry *>;
-typedef QMap<QString, TypeEntry *> TypeEntryMap;
-typedef QMap<QString, TypedefEntry *> TypedefEntryMap;
+using TypeEntryMap = QMap<QString, TypeEntry *>;
+using TypedefEntryMap = QMap<QString, TypedefEntry *>;
-typedef QVector<const ContainerTypeEntry *> ContainerTypeEntryList;
+using ContainerTypeEntryList = QVector<const ContainerTypeEntry *>;
using NamespaceTypeEntryList = QVector<NamespaceTypeEntry *>;
-typedef QVector<const PrimitiveTypeEntry *> PrimitiveTypeEntryList;
+using PrimitiveTypeEntryList = QVector<const PrimitiveTypeEntry *>;
#endif // TYPEDATABASE_TYPEDEFS_H
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 344313e8..65e3443d 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();
}
@@ -698,7 +698,7 @@ bool Handler::endElement(const QStringRef &localName)
if (m_currentDroppedEntryDepth == 1) {
m_current = m_currentDroppedEntry->parent;
delete m_currentDroppedEntry;
- m_currentDroppedEntry = 0;
+ m_currentDroppedEntry = nullptr;
m_currentDroppedEntryDepth = 0;
} else {
--m_currentDroppedEntryDepth;
@@ -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);
@@ -785,7 +785,7 @@ bool Handler::endElement(const QStringRef &localName)
case StackElement::EnumTypeEntry:
m_current->entry->setDocModification(m_contextStack.top()->docModifications);
m_contextStack.top()->docModifications = DocModificationList();
- m_currentEnum = 0;
+ m_currentEnum = nullptr;
break;
case StackElement::Template:
m_database->addTemplate(m_current->value.templateEntry);
@@ -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)
@@ -1651,8 +1650,8 @@ bool Handler::loadTypesystem(const QXmlStreamReader &,
const QStringRef name = attributes->at(i).qualifiedName();
if (name == nameAttribute())
typeSystemName = attributes->takeAt(i).value().toString();
- else if (name == generateAttribute())
- generateChild = convertBoolean(attributes->takeAt(i).value(), generateAttribute(), true);
+ else if (name == generateAttribute())
+ generateChild = convertBoolean(attributes->takeAt(i).value(), generateAttribute(), true);
}
if (typeSystemName.isEmpty()) {
m_error = QLatin1String("No typesystem name specified");
@@ -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;
}
@@ -1805,8 +1804,8 @@ bool Handler::parseAddConversion(const QXmlStreamReader &,
const QStringRef name = attributes->at(i).qualifiedName();
if (name == QLatin1String("type"))
sourceTypeName = attributes->takeAt(i).value().toString();
- else if (name == QLatin1String("check"))
- typeCheck = attributes->takeAt(i).value().toString();
+ else if (name == QLatin1String("check"))
+ typeCheck = attributes->takeAt(i).value().toString();
}
if (sourceTypeName.isEmpty()) {
m_error = QLatin1String("Target to Native conversions must specify the input type with the 'type' attribute.");
@@ -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)
@@ -2807,7 +2806,7 @@ bool Handler::startElement(const QXmlStreamReader &reader)
return false;
}
- StackElement topElement = !m_current ? StackElement(0) : *m_current;
+ StackElement topElement = !m_current ? StackElement(nullptr) : *m_current;
element->entry = topElement.entry;
switch (element->type) {
@@ -3003,7 +3002,7 @@ QString PrimitiveTypeEntry::targetLangApiName() const
PrimitiveTypeEntry *PrimitiveTypeEntry::basicReferencedTypeEntry() const
{
if (!m_referencedTypeEntry)
- return 0;
+ return nullptr;
PrimitiveTypeEntry *baseReferencedTypeEntry = m_referencedTypeEntry->basicReferencedTypeEntry();
return baseReferencedTypeEntry ? baseReferencedTypeEntry : m_referencedTypeEntry;
@@ -3043,9 +3042,10 @@ FunctionModificationList ComplexTypeEntry::functionModifications(const QString &
FieldModification ComplexTypeEntry::fieldModification(const QString &name) const
{
- for (int i = 0; i < m_fieldMods.size(); ++i)
- if (m_fieldMods.at(i).name == name)
- return m_fieldMods.at(i);
+ for (const auto &fieldMod : m_fieldMods) {
+ if (fieldMod.name == name)
+ return fieldMod;
+ }
FieldModification mod;
mod.name = name;
mod.modifiers = FieldModification::Readable | FieldModification::Writable;
@@ -3384,7 +3384,7 @@ AddedFunction::AddedFunction(QString signature, const QString &returnType) :
if (!arg.name.isEmpty())
m_arguments.append({argumentName, arg});
// end of parameters...
- if (signature[endPos] == QLatin1Char(')'))
+ if (endPos >= signatureLength || signature[endPos] == QLatin1Char(')'))
break;
}
// is const?
@@ -3926,7 +3926,7 @@ struct CustomConversion::CustomConversionPrivate
struct CustomConversion::TargetToNativeConversion::TargetToNativeConversionPrivate
{
TargetToNativeConversionPrivate()
- : sourceType(0)
+ : sourceType(nullptr)
{
}
const TypeEntry* sourceType;
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 82a69810..6a88ecd4 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -55,7 +55,7 @@ QT_END_NAMESPACE
class EnumTypeEntry;
class FlagsTypeEntry;
-typedef QMap<int, QString> ArgumentMap;
+using ArgumentMap = QMap<int, QString>;
class TemplateInstance;
@@ -186,9 +186,9 @@ public:
struct ArgumentModification
{
ArgumentModification() : removedDefaultExpression(false), removed(false),
- noNullPointers(false), array(false) {}
+ noNullPointers(false), resetAfterUse(false), array(false) {}
explicit ArgumentModification(int idx) : index(idx), removedDefaultExpression(false), removed(false),
- noNullPointers(false), array(false) {}
+ noNullPointers(false), resetAfterUse(false), array(false) {}
// Should the default expression be removed?
@@ -548,6 +548,10 @@ class TypeEntry
{
Q_GADGET
public:
+ TypeEntry &operator=(const TypeEntry &) = delete;
+ TypeEntry &operator=(TypeEntry &&) = delete;
+ TypeEntry(TypeEntry &&) = delete;
+
enum Type {
PrimitiveType,
VoidType,
@@ -770,7 +774,7 @@ public:
virtual InterfaceTypeEntry *designatedInterface() const
{
- return 0;
+ return nullptr;
}
void setCustomConstructor(const CustomFunction &func)
@@ -901,10 +905,6 @@ protected:
TypeEntry(const TypeEntry &);
private:
- TypeEntry &operator=(const TypeEntry &) = delete;
- TypeEntry &operator=(TypeEntry &&) = delete;
- TypeEntry(TypeEntry &&) = delete;
-
QString m_name;
QString m_targetLangPackage;
Type m_type;
@@ -1225,7 +1225,7 @@ public:
enum TypeFlag {
Deprecated = 0x4
};
- typedef QFlags<TypeFlag> TypeFlags;
+ Q_DECLARE_FLAGS(TypeFlags, TypeFlag)
enum CopyableFlag {
CopyableSet,
@@ -1366,7 +1366,7 @@ public:
{
return m_hashFunction;
}
- void setHashFunction(QString hashFunction)
+ void setHashFunction(const QString &hashFunction)
{
m_hashFunction = hashFunction;
}
@@ -1427,6 +1427,8 @@ private:
TypeSystem::AllowThread m_allowThread = TypeSystem::AllowThread::Unspecified;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(ComplexTypeEntry::TypeFlags)
+
class TypedefEntry : public ComplexTypeEntry
{
public:
@@ -1446,7 +1448,7 @@ public:
void setTarget(ComplexTypeEntry *target) { m_target = target; }
#ifndef QT_NO_DEBUG_STREAM
- virtual void formatDebug(QDebug &d) const override;
+ void formatDebug(QDebug &d) const override;
#endif
protected:
TypedefEntry(const TypedefEntry &);
@@ -1605,7 +1607,7 @@ protected:
InterfaceTypeEntry(const InterfaceTypeEntry &);
private:
- ObjectTypeEntry *m_origin;
+ ObjectTypeEntry *m_origin = nullptr;
};
@@ -1675,7 +1677,7 @@ struct TypeRejection
QRegularExpression className;
QRegularExpression pattern;
- MatchType matchType;
+ MatchType matchType = Invalid;
};
#ifndef QT_NO_DEBUG_STREAM
@@ -1722,7 +1724,7 @@ public:
bool replaceOriginalTargetToNativeConversions() const;
void setReplaceOriginalTargetToNativeConversions(bool replaceOriginalTargetToNativeConversions);
- typedef QVector<TargetToNativeConversion*> TargetToNativeConversions;
+ using TargetToNativeConversions = QVector<TargetToNativeConversion *>;
bool hasTargetToNativeConversions() const;
TargetToNativeConversions& targetToNativeConversions();
const TargetToNativeConversions& targetToNativeConversions() const;
diff --git a/sources/shiboken2/ApiExtractor/typesystem_p.h b/sources/shiboken2/ApiExtractor/typesystem_p.h
index 8a8fcb35..5b8b93ce 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_p.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_p.h
@@ -114,7 +114,7 @@ class StackElement
ArgumentModifiers = 0xff000000
};
- StackElement(StackElement *p) : entry(0), type(None), parent(p) { }
+ StackElement(StackElement *p) : entry(nullptr), type(None), parent(p) { }
TypeEntry* entry;
ElementType type;
diff --git a/sources/shiboken2/ApiExtractor/typesystem_typedefs.h b/sources/shiboken2/ApiExtractor/typesystem_typedefs.h
index 5cea587e..fd702793 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_typedefs.h
@@ -43,9 +43,9 @@ struct FunctionModification;
using AddedFunctionPtr = QSharedPointer<AddedFunction>;
using AddedFunctionList = QVector<AddedFunctionPtr>;
-typedef QVector<CodeSnip> CodeSnipList;
-typedef QVector<DocModification> DocModificationList;
-typedef QVector<FieldModification> FieldModificationList;
-typedef QVector<FunctionModification> FunctionModificationList;
+using CodeSnipList = QVector<CodeSnip>;
+using DocModificationList = QVector<DocModification>;
+using FieldModificationList = QVector<FieldModification>;
+using FunctionModificationList = QVector<FunctionModification>;
#endif // TYPESYSTEM_TYPEDEFS_H