aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp14
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp1
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.cpp16
-rw-r--r--sources/shiboken2/ApiExtractor/graph.cpp3
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp20
8 files changed, 27 insertions, 33 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 79d69abf3..32036749d 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -487,7 +487,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
const QSet<NamespaceModelItem> &namespaceTypeValues = dom->uniqueNamespaces();
ReportHandler::setProgressReference(namespaceTypeValues);
- for (NamespaceModelItem item : namespaceTypeValues) {
+ for (const NamespaceModelItem &item : namespaceTypeValues) {
ReportHandler::progress(QLatin1String("Generating namespace model..."));
AbstractMetaClass *metaClass = traverseNamespace(dom, item);
if (metaClass)
@@ -1143,7 +1143,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(EnumModelItem enumIte
// Register all enum values on Type database
const EnumeratorList &enumerators = enumItem->enumerators();
- for (EnumeratorModelItem e : enumItem->enumerators()) {
+ for (const EnumeratorModelItem &e : enumerators) {
QString name;
if (enclosing) {
name += enclosing->name();
@@ -1645,8 +1645,8 @@ AbstractMetaFunctionList AbstractMetaBuilderPrivate::templateClassFunctionList(c
}
}
- const AbstractMetaFunctionList::ConstIterator unchangedBegin = unchangedFunctions.begin();
- const AbstractMetaFunctionList::ConstIterator unchangedEnd = unchangedFunctions.end();
+ const AbstractMetaFunctionList::ConstIterator unchangedBegin = unchangedFunctions.cbegin();
+ const AbstractMetaFunctionList::ConstIterator unchangedEnd = unchangedFunctions.cend();
for (int i = result.size() - 1; i >= 0; --i) {
AbstractMetaFunction *function = result.at(i);
if (!unchangedFunctions.contains(function)
@@ -3034,10 +3034,8 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(AbstractMetaClass *subclass,
QString templateParamName;
for (const QString &possibleName : qAsConst(possibleNames)) {
t = typeDb->findType(possibleName);
- if (t) {
- QString templateParamName = possibleName;
+ if (t)
break;
- }
}
if (t) {
@@ -3185,8 +3183,6 @@ void AbstractMetaBuilderPrivate::parseQ_Property(AbstractMetaClass *metaClass,
continue;
}
- QString typeName = scope + l.at(0);
-
QPropertySpec* spec = new QPropertySpec(type->typeEntry());
spec->setName(l.at(1));
spec->setIndex(i);
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index 19e6a0f26..840466108 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -1326,7 +1326,6 @@ void AbstractMetaClass::setFunctions(const AbstractMetaFunctionList &functions)
// Functions must be sorted by name before next loop
sortFunctions();
- QString currentName;
for (AbstractMetaFunction *f : qAsConst(m_functions)) {
f->setOwnerClass(this);
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.cpp b/sources/shiboken2/ApiExtractor/apiextractor.cpp
index 404e0bea6..6508d378a 100644
--- a/sources/shiboken2/ApiExtractor/apiextractor.cpp
+++ b/sources/shiboken2/ApiExtractor/apiextractor.cpp
@@ -46,7 +46,7 @@
ApiExtractor::ApiExtractor() : m_builder(0)
{
// Environment TYPESYSTEMPATH
- QString envTypesystemPaths = QFile::decodeName(getenv("TYPESYSTEMPATH"));
+ QString envTypesystemPaths = QFile::decodeName(qgetenv("TYPESYSTEMPATH"));
if (!envTypesystemPaths.isEmpty())
TypeDatabase::instance()->addTypesystemPath(envTypesystemPaths);
}
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
index ea08ff6f9..16a7a3147 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
@@ -260,7 +260,7 @@ bool parse(const QByteArrayList &clangArgs, unsigned clangFlags, BaseVisitor &b
debug.nospace();
debug << "Errors in "
<< QDir::toNativeSeparators(QFile::decodeName(clangArgs.constLast())) << ":\n";
- for (const Diagnostic &diagnostic : diagnostics)
+ for (const Diagnostic &diagnostic : qAsConst(diagnostics))
debug << diagnostic << '\n';
}
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp
index fdc8d3312..f30a585bc 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp
@@ -163,7 +163,7 @@ QVector<Diagnostic> getDiagnostics(CXTranslationUnit tu)
CXDiagnosticSeverity maxSeverity(const QVector<Diagnostic> &ds)
{
CXDiagnosticSeverity result = CXDiagnostic_Ignored;
- for (const Diagnostic d : ds) {
+ for (const Diagnostic& d : ds) {
if (d.severity > result)
result = d.severity;
}
diff --git a/sources/shiboken2/ApiExtractor/fileout.cpp b/sources/shiboken2/ApiExtractor/fileout.cpp
index c97347fe1..be0023c3c 100644
--- a/sources/shiboken2/ApiExtractor/fileout.cpp
+++ b/sources/shiboken2/ApiExtractor/fileout.cpp
@@ -39,15 +39,15 @@ bool FileOut::dummy = false;
bool FileOut::diff = false;
#ifdef Q_OS_LINUX
-const char* colorDelete = "\033[31m";
-const char* colorAdd = "\033[32m";
-const char* colorInfo = "\033[36m";
-const char* colorReset = "\033[0m";
+static const char colorDelete[] = "\033[31m";
+static const char colorAdd[] = "\033[32m";
+static const char colorInfo[] = "\033[36m";
+static const char colorReset[] = "\033[0m";
#else
-const char* colorDelete = "";
-const char* colorAdd = "";
-const char* colorInfo = "";
-const char* colorReset = "";
+static const char colorDelete[] = "";
+static const char colorAdd[] = "";
+static const char colorInfo[] = "";
+static const char colorReset[] = "";
#endif
FileOut::FileOut(QString n):
diff --git a/sources/shiboken2/ApiExtractor/graph.cpp b/sources/shiboken2/ApiExtractor/graph.cpp
index e6ee660dc..6ba4d994a 100644
--- a/sources/shiboken2/ApiExtractor/graph.cpp
+++ b/sources/shiboken2/ApiExtractor/graph.cpp
@@ -127,8 +127,7 @@ void Graph::dumpDot(const QHash< int, QString >& nodeNames, const QString& fileN
QTextStream s(&output);
s << "digraph D {\n";
for (int i = 0; i < m_d->edges.size(); ++i) {
- GraphPrivate::EdgeIterator it = m_d->edges[i].begin();
- for (;it != m_d->edges[i].end(); ++it)
+ for (auto it = m_d->edges[i].cbegin(), end = m_d->edges[i].cend(); it != end; ++it)
s << '"' << nodeNames[i] << "\" -> \"" << nodeNames[*it] << "\"\n";
}
s << "}\n";
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index c6f723e4d..8564da3c4 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -373,6 +373,7 @@ bool Handler::endElement(const QStringRef &localName)
m_current->parent->entry->setCodeSnips(snips);
break;
}
+ Q_FALLTHROUGH();
case StackElement::NativeToTarget:
case StackElement::AddConversion:
m_contextStack.top()->codeSnips.last().addTemplateInstance(m_current->value.templateInstance);
@@ -756,20 +757,20 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
break;
case StackElement::ValueTypeEntry:
attributes.insert(QLatin1String("default-constructor"), QString());
- // fall throooough
+ Q_FALLTHROUGH();
case StackElement::ObjectTypeEntry:
attributes.insert(QLatin1String("force-abstract"), QLatin1String("no"));
attributes.insert(QLatin1String("deprecated"), QLatin1String("no"));
attributes.insert(QLatin1String("hash-function"), QString());
attributes.insert(QLatin1String("stream"), QLatin1String("no"));
- // fall throooough
+ Q_FALLTHROUGH();
case StackElement::InterfaceTypeEntry:
attributes[QLatin1String("default-superclass")] = m_defaultSuperclass;
attributes.insert(QLatin1String("polymorphic-id-expression"), QString());
attributes.insert(QLatin1String("delete-in-main-thread"), QLatin1String("no"));
attributes.insert(QLatin1String("held-type"), QString());
attributes.insert(QLatin1String("copyable"), QString());
- // fall through
+ Q_FALLTHROUGH();
case StackElement::NamespaceTypeEntry:
attributes.insert(QLatin1String("target-lang-name"), QString());
attributes[QLatin1String("package")] = m_defaultPackage;
@@ -968,7 +969,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
itype->setOrigin(otype);
element->entry = otype;
}
- // fall through
+ Q_FALLTHROUGH();
case StackElement::ValueTypeEntry: {
if (!element->entry) {
ValueTypeEntry* typeEntry = new ValueTypeEntry(name, since);
@@ -978,12 +979,12 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
element->entry = typeEntry;
}
- // fall through
+ Q_FALLTHROUGH();
case StackElement::NamespaceTypeEntry:
if (!element->entry)
element->entry = new NamespaceTypeEntry(name, since);
- // fall through
+ Q_FALLTHROUGH();
case StackElement::ObjectTypeEntry:
if (!element->entry)
element->entry = new ObjectTypeEntry(name, since);
@@ -1334,13 +1335,12 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
}
}
break;
- case StackElement::RejectEnumValue: {
+ case StackElement::RejectEnumValue:
if (!m_currentEnum) {
m_error = QLatin1String("<reject-enum-value> node must be used inside a <enum-type> node");
return false;
}
- QString name = attributes[nameAttribute()];
- } break;
+ break;
case StackElement::ReplaceType: {
if (topElement.type != StackElement::ModifyArgument) {
m_error = QLatin1String("Type replacement can only be specified for argument modifications");
@@ -2495,7 +2495,7 @@ AddedFunction::AddedFunction(QString signature, QString returnType, double vr) :
break;
}
// is const?
- m_isConst = signature.right(signatureLength - endPos).contains(QLatin1String("const"));
+ m_isConst = signature.rightRef(signatureLength - endPos).contains(QLatin1String("const"));
}
}