aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-25 09:39:12 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-25 11:31:27 +0200
commitd8e42fbde07db9980e182e80a7b42c20d1485f8d (patch)
treec409234d4b669c43c8713b1f26bad9dac48039a8 /sources
parent6a22e8cb35cfccbacd65b56e193bf2ae83f205ea (diff)
shiboken: Introduce member initialization
Use member initialization, use default bodies for constructors. Initialize missing members as reported by clang. Change-Id: Ibc51e46a37b310912ec8f274543092dfdda78e1b Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp3
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h2
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.h2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.h6
-rw-r--r--sources/shiboken2/ApiExtractor/include.h4
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h2
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h8
-rw-r--r--sources/shiboken2/generator/generator.h8
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.h16
-rw-r--r--sources/shiboken2/libshiboken/gilstate.cpp1
-rw-r--r--sources/shiboken2/libshiboken/gilstate.h2
-rw-r--r--sources/shiboken2/libshiboken/threadstatesaver.cpp4
-rw-r--r--sources/shiboken2/libshiboken/threadstatesaver.h2
15 files changed, 29 insertions, 35 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index d3a232546..b1f3fd5fb 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -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())
{
}
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
index 1fd5f3c34..82488ccba 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
@@ -190,7 +190,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/apiextractor.cpp b/sources/shiboken2/ApiExtractor/apiextractor.cpp
index fbe7664e9..44fb70089 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"));
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.h b/sources/shiboken2/ApiExtractor/apiextractor.h
index 3eb90e748..a5c3fadf3 100644
--- a/sources/shiboken2/ApiExtractor/apiextractor.h
+++ b/sources/shiboken2/ApiExtractor/apiextractor.h
@@ -97,7 +97,7 @@ 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;
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
index db2db6267..2546d5998 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
@@ -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);
diff --git a/sources/shiboken2/ApiExtractor/include.h b/sources/shiboken2/ApiExtractor/include.h
index 4890eea2c..c312dd6cc 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;
};
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index 930f85d30..6a5e8d8ba 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -56,7 +56,7 @@ typedef QVector<ApiVersion> ApiVersions;
Q_GLOBAL_STATIC(ApiVersions, apiVersions)
-TypeDatabase::TypeDatabase() : m_suppressWarnings(true)
+TypeDatabase::TypeDatabase()
{
addType(new VoidTypeEntry());
addType(new VarargsTypeEntry());
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index df614e644..334e88a14 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -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/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 82a698107..d95fad340 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -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?
@@ -1605,7 +1605,7 @@ protected:
InterfaceTypeEntry(const InterfaceTypeEntry &);
private:
- ObjectTypeEntry *m_origin;
+ ObjectTypeEntry *m_origin = nullptr;
};
@@ -1675,7 +1675,7 @@ struct TypeRejection
QRegularExpression className;
QRegularExpression pattern;
- MatchType matchType;
+ MatchType matchType = Invalid;
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/sources/shiboken2/generator/generator.h b/sources/shiboken2/generator/generator.h
index b7b002ea6..1642752be 100644
--- a/sources/shiboken2/generator/generator.h
+++ b/sources/shiboken2/generator/generator.h
@@ -147,7 +147,7 @@ private:
*/
class GeneratorContext {
public:
- GeneratorContext() : m_metaClass(0), m_preciseClassType(0), m_forSmartPointer(false) {}
+ GeneratorContext() = default;
GeneratorContext(AbstractMetaClass *metaClass,
const AbstractMetaType *preciseType = 0,
bool forSmartPointer = false)
@@ -161,9 +161,9 @@ public:
const AbstractMetaType *preciseType() const { return m_preciseClassType; }
private:
- AbstractMetaClass *m_metaClass;
- const AbstractMetaType *m_preciseClassType;
- bool m_forSmartPointer;
+ AbstractMetaClass *m_metaClass = nullptr;
+ const AbstractMetaType *m_preciseClassType = nullptr;
+ bool m_forSmartPointer = false;
};
/**
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
index 21afd0f49..86404c873 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
@@ -59,21 +59,19 @@ public:
struct TableCell
{
- short rowSpan;
- short colSpan;
+ short rowSpan = 0;
+ short colSpan = 0;
QString data;
- TableCell(const QString& text = QString()) : rowSpan(0), colSpan(0), data(text) {}
- TableCell(const char* text) : rowSpan(0), colSpan(0), data(QLatin1String(text)) {}
+ TableCell(const QString& text = QString()) : data(text) {}
+ TableCell(const char* text) : data(QLatin1String(text)) {}
};
typedef QList<TableCell> TableRow;
class Table : public QList<TableRow>
{
public:
- Table() : m_hasHeader(false), m_normalized(false)
- {
- }
+ Table() = default;
void enableHeader(bool enable)
{
@@ -98,8 +96,8 @@ public:
}
private:
- bool m_hasHeader;
- bool m_normalized;
+ bool m_hasHeader = false;
+ bool m_normalized = false;
};
QtXmlToSphinx(QtDocGenerator* generator, const QString& doc, const QString& context = QString());
diff --git a/sources/shiboken2/libshiboken/gilstate.cpp b/sources/shiboken2/libshiboken/gilstate.cpp
index 64a0b60f3..a59c6f01e 100644
--- a/sources/shiboken2/libshiboken/gilstate.cpp
+++ b/sources/shiboken2/libshiboken/gilstate.cpp
@@ -43,7 +43,6 @@ namespace Shiboken
{
GilState::GilState()
- : m_locked(false)
{
if (Py_IsInitialized()) {
m_gstate = PyGILState_Ensure();
diff --git a/sources/shiboken2/libshiboken/gilstate.h b/sources/shiboken2/libshiboken/gilstate.h
index f0ff45d59..d22f688ba 100644
--- a/sources/shiboken2/libshiboken/gilstate.h
+++ b/sources/shiboken2/libshiboken/gilstate.h
@@ -59,7 +59,7 @@ public:
void release();
private:
PyGILState_STATE m_gstate;
- bool m_locked;
+ bool m_locked = false;
};
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/threadstatesaver.cpp b/sources/shiboken2/libshiboken/threadstatesaver.cpp
index 517341617..d64c01f86 100644
--- a/sources/shiboken2/libshiboken/threadstatesaver.cpp
+++ b/sources/shiboken2/libshiboken/threadstatesaver.cpp
@@ -42,9 +42,7 @@
namespace Shiboken
{
-ThreadStateSaver::ThreadStateSaver()
- : m_threadState(0)
- {}
+ThreadStateSaver::ThreadStateSaver() = default;
ThreadStateSaver::~ThreadStateSaver()
{
diff --git a/sources/shiboken2/libshiboken/threadstatesaver.h b/sources/shiboken2/libshiboken/threadstatesaver.h
index 10b3af12b..ddfbcb93b 100644
--- a/sources/shiboken2/libshiboken/threadstatesaver.h
+++ b/sources/shiboken2/libshiboken/threadstatesaver.h
@@ -59,7 +59,7 @@ public:
void save();
void restore();
private:
- PyThreadState *m_threadState;
+ PyThreadState *m_threadState = nullptr;
};
} // namespace Shiboken