summaryrefslogtreecommitdiffstats
path: root/src/tools/moc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/moc')
-rw-r--r--src/tools/moc/generator.cpp97
-rw-r--r--src/tools/moc/generator.h39
-rw-r--r--src/tools/moc/keywords.cpp29
-rw-r--r--src/tools/moc/main.cpp54
-rw-r--r--src/tools/moc/moc.cpp219
-rw-r--r--src/tools/moc/moc.h57
-rw-r--r--src/tools/moc/moc.pro7
-rw-r--r--src/tools/moc/mwerks_mac.cpp29
-rw-r--r--src/tools/moc/mwerks_mac.h29
-rw-r--r--src/tools/moc/outputrevision.h29
-rw-r--r--src/tools/moc/parser.cpp29
-rw-r--r--src/tools/moc/parser.h34
-rw-r--r--src/tools/moc/ppkeywords.cpp29
-rw-r--r--src/tools/moc/preprocessor.cpp70
-rw-r--r--src/tools/moc/preprocessor.h29
-rw-r--r--src/tools/moc/symbols.h29
-rw-r--r--src/tools/moc/token.cpp29
-rw-r--r--src/tools/moc/token.h29
-rwxr-xr-xsrc/tools/moc/util/generate.sh29
-rw-r--r--src/tools/moc/util/generate_keywords.cpp29
-rw-r--r--src/tools/moc/util/licenseheader.txt29
-rw-r--r--src/tools/moc/utils.h29
22 files changed, 461 insertions, 522 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 99629f0427..7de6fe632f 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1,32 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -84,7 +79,7 @@ Generator::Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes, con
, knownGadgets(knownGadgets)
{
if (cdef->superclassList.size())
- purestSuperClass = cdef->superclassList.first().first;
+ purestSuperClass = cdef->superclassList.constFirst().first;
}
static inline int lengthOfEscapeSequence(const QByteArray &s, int i)
@@ -126,7 +121,7 @@ int Generator::stridx(const QByteArray &s)
// Returns the sum of all parameters (including return type) for the given
// \a list of methods. This is needed for calculating the size of the methods'
// parameter type/name meta-data.
-static int aggregateParameterCount(const QList<FunctionDef> &list)
+static int aggregateParameterCount(const QVector<FunctionDef> &list)
{
int sum = 0;
for (int i = 0; i < list.count(); ++i)
@@ -155,16 +150,17 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
#undef STREAM_SMART_POINTER
;
- foreach (const QByteArray &smartPointer, smartPointers)
+ for (const QByteArray &smartPointer : smartPointers) {
if (propertyType.startsWith(smartPointer + "<") && !propertyType.endsWith("&"))
return knownQObjectClasses.contains(propertyType.mid(smartPointer.size() + 1, propertyType.size() - smartPointer.size() - 1 - 1));
+ }
static const QVector<QByteArray> oneArgTemplates = QVector<QByteArray>()
#define STREAM_1ARG_TEMPLATE(TEMPLATENAME) << #TEMPLATENAME
QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(STREAM_1ARG_TEMPLATE)
#undef STREAM_1ARG_TEMPLATE
;
- foreach (const QByteArray &oneArgTemplateType, oneArgTemplates)
+ for (const QByteArray &oneArgTemplateType : oneArgTemplates) {
if (propertyType.startsWith(oneArgTemplateType + "<") && propertyType.endsWith(">")) {
const int argumentSize = propertyType.size() - oneArgTemplateType.size() - 1
// The closing '>'
@@ -174,6 +170,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType)
const QByteArray templateArg = propertyType.mid(oneArgTemplateType.size() + 1, argumentSize);
return isBuiltinType(templateArg) || registerableMetaType(templateArg);
}
+ }
return false;
}
@@ -197,7 +194,7 @@ void Generator::generateCode()
// filter out undeclared enumerators and sets
{
- QList<EnumDef> enumList;
+ QVector<EnumDef> enumList;
for (int i = 0; i < cdef->enumList.count(); ++i) {
EnumDef def = cdef->enumList.at(i);
if (cdef->enumDeclarations.contains(def.name)) {
@@ -502,9 +499,9 @@ void Generator::generateCode()
// QTBUG-20639 - Accept non-local enums for QML signal/slot parameters.
// Look for any scoped enum declarations, and add those to the list
// of extra/related metaobjects for this object.
- QList<QByteArray> enumKeys = cdef->enumDeclarations.keys();
- for (int i = 0; i < enumKeys.count(); ++i) {
- const QByteArray &enumKey = enumKeys[i];
+ for (auto it = cdef->enumDeclarations.keyBegin(),
+ end = cdef->enumDeclarations.keyEnd(); it != end; ++it) {
+ const QByteArray &enumKey = *it;
int s = enumKey.lastIndexOf("::");
if (s > 0) {
QByteArray scope = enumKey.left(s);
@@ -574,7 +571,7 @@ void Generator::generateCode()
cname, cname, cdef->classname.constData());
}
for (int i = 0; i < cdef->interfaceList.size(); ++i) {
- const QList<ClassDef::Interface> &iface = cdef->interfaceList.at(i);
+ const QVector<ClassDef::Interface> &iface = cdef->interfaceList.at(i);
for (int j = 0; j < iface.size(); ++j) {
fprintf(out, " if (!strcmp(_clname, %s))\n return ", iface.at(j).interfaceId.constData());
for (int k = j; k >= 0; --k)
@@ -631,7 +628,7 @@ void Generator::generateClassInfos()
}
}
-void Generator::registerFunctionStrings(const QList<FunctionDef>& list)
+void Generator::registerFunctionStrings(const QVector<FunctionDef>& list)
{
for (int i = 0; i < list.count(); ++i) {
const FunctionDef &f = list.at(i);
@@ -651,7 +648,7 @@ void Generator::registerFunctionStrings(const QList<FunctionDef>& list)
}
}
-void Generator::generateFunctions(const QList<FunctionDef>& list, const char *functype, int type, int &paramsIndex)
+void Generator::generateFunctions(const QVector<FunctionDef>& list, const char *functype, int type, int &paramsIndex)
{
if (list.isEmpty())
return;
@@ -697,7 +694,7 @@ void Generator::generateFunctions(const QList<FunctionDef>& list, const char *fu
}
}
-void Generator::generateFunctionRevisions(const QList<FunctionDef>& list, const char *functype)
+void Generator::generateFunctionRevisions(const QVector<FunctionDef>& list, const char *functype)
{
if (list.count())
fprintf(out, "\n // %ss: revision\n", functype);
@@ -707,7 +704,7 @@ void Generator::generateFunctionRevisions(const QList<FunctionDef>& list, const
}
}
-void Generator::generateFunctionParameters(const QList<FunctionDef>& list, const char *functype)
+void Generator::generateFunctionParameters(const QVector<FunctionDef>& list, const char *functype)
{
if (list.isEmpty())
return;
@@ -920,7 +917,7 @@ void Generator::generateMetacall()
fprintf(out, " ");
bool needElse = false;
- QList<FunctionDef> methodList;
+ QVector<FunctionDef> methodList;
methodList += cdef->signalList;
methodList += cdef->slotList;
methodList += cdef->methodList;
@@ -1082,7 +1079,7 @@ QMultiMap<QByteArray, int> Generator::automaticPropertyMetaTypesHelper()
return automaticPropertyMetaTypes;
}
-QMap<int, QMultiMap<QByteArray, int> > Generator::methodsWithAutomaticTypesHelper(const QList<FunctionDef> &methodList)
+QMap<int, QMultiMap<QByteArray, int> > Generator::methodsWithAutomaticTypesHelper(const QVector<FunctionDef> &methodList)
{
QMap<int, QMultiMap<QByteArray, int> > methodsWithAutomaticTypes;
for (int i = 0; i < methodList.size(); ++i) {
@@ -1136,7 +1133,7 @@ void Generator::generateStaticMetacall()
isUsed_a = true;
}
- QList<FunctionDef> methodList;
+ QVector<FunctionDef> methodList;
methodList += cdef->signalList;
methodList += cdef->slotList;
methodList += cdef->methodList;
@@ -1207,10 +1204,14 @@ void Generator::generateStaticMetacall()
fprintf(out, " case %d:\n", it.key());
fprintf(out, " switch (*reinterpret_cast<int*>(_a[1])) {\n");
fprintf(out, " default: *reinterpret_cast<int*>(_a[0]) = -1; break;\n");
- foreach (const QByteArray &key, it->uniqueKeys()) {
- foreach (int argumentID, it->values(key))
- fprintf(out, " case %d:\n", argumentID);
- fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", key.constData());
+ auto jt = it->begin();
+ const auto jend = it->end();
+ while (jt != jend) {
+ fprintf(out, " case %d:\n", jt.value());
+ const QByteArray &lastKey = jt.key();
+ ++jt;
+ if (jt == jend || jt.key() != lastKey)
+ fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", lastKey.constData());
}
fprintf(out, " }\n");
fprintf(out, " break;\n");
@@ -1263,7 +1264,7 @@ void Generator::generateStaticMetacall()
needElse = true;
}
- QMultiMap<QByteArray, int> automaticPropertyMetaTypes = automaticPropertyMetaTypesHelper();
+ const QMultiMap<QByteArray, int> automaticPropertyMetaTypes = automaticPropertyMetaTypesHelper();
if (!automaticPropertyMetaTypes.isEmpty()) {
if (needElse)
@@ -1273,10 +1274,14 @@ void Generator::generateStaticMetacall()
fprintf(out, "if (_c == QMetaObject::RegisterPropertyMetaType) {\n");
fprintf(out, " switch (_id) {\n");
fprintf(out, " default: *reinterpret_cast<int*>(_a[0]) = -1; break;\n");
- foreach (const QByteArray &key, automaticPropertyMetaTypes.uniqueKeys()) {
- foreach (int propertyID, automaticPropertyMetaTypes.values(key))
- fprintf(out, " case %d:\n", propertyID);
- fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", key.constData());
+ auto it = automaticPropertyMetaTypes.begin();
+ const auto end = automaticPropertyMetaTypes.end();
+ while (it != end) {
+ fprintf(out, " case %d:\n", it.value());
+ const QByteArray &lastKey = it.key();
+ ++it;
+ if (it == end || it.key() != lastKey)
+ fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", lastKey.constData());
}
fprintf(out, " }\n");
fprintf(out, " }\n");
@@ -1461,9 +1466,7 @@ void Generator::generateSignal(FunctionDef *def,int index)
const char *constQualifier = "";
if (def->isConst) {
- thisPtr = "const_cast< ";
- thisPtr += cdef->qualified;
- thisPtr += " *>(this)";
+ thisPtr = "const_cast< " + cdef->qualified + " *>(this)";
constQualifier = "const";
}
@@ -1567,8 +1570,8 @@ void Generator::generatePluginMetaData()
data.insert(QStringLiteral("MetaData"), cdef->pluginData.metaData.object());
// Add -M args from the command line:
- foreach (const QString &key, cdef->pluginData.metaArgs.keys())
- data.insert(key, cdef->pluginData.metaArgs.value(key));
+ for (auto it = cdef->pluginData.metaArgs.cbegin(), end = cdef->pluginData.metaArgs.cend(); it != end; ++it)
+ data.insert(it.key(), it.value());
fputs("\nQT_PLUGIN_METADATA_SECTION const uint qt_section_alignment_dummy = 42;\n\n"
"#ifdef QT_NO_DEBUG\n", out);
diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h
index b9cc2bc553..3833148fb3 100644
--- a/src/tools/moc/generator.h
+++ b/src/tools/moc/generator.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,10 +45,10 @@ private:
bool registerableMetaType(const QByteArray &propertyType);
void registerClassInfoStrings();
void generateClassInfos();
- void registerFunctionStrings(const QList<FunctionDef> &list);
- void generateFunctions(const QList<FunctionDef> &list, const char *functype, int type, int &paramsIndex);
- void generateFunctionRevisions(const QList<FunctionDef>& list, const char *functype);
- void generateFunctionParameters(const QList<FunctionDef> &list, const char *functype);
+ void registerFunctionStrings(const QVector<FunctionDef> &list);
+ void generateFunctions(const QVector<FunctionDef> &list, const char *functype, int type, int &paramsIndex);
+ void generateFunctionRevisions(const QVector<FunctionDef> &list, const char *functype);
+ void generateFunctionParameters(const QVector<FunctionDef> &list, const char *functype);
void generateTypeInfo(const QByteArray &typeName, bool allowEmptyName = false);
void registerEnumStrings();
void generateEnums(int index);
@@ -64,7 +59,7 @@ private:
void generateSignal(FunctionDef *def, int index);
void generatePluginMetaData();
QMultiMap<QByteArray, int> automaticPropertyMetaTypesHelper();
- QMap<int, QMultiMap<QByteArray, int> > methodsWithAutomaticTypesHelper(const QList<FunctionDef> &methodList);
+ QMap<int, QMultiMap<QByteArray, int> > methodsWithAutomaticTypesHelper(const QVector<FunctionDef> &methodList);
void strreg(const QByteArray &); // registers a string
int stridx(const QByteArray &); // returns a string's id
diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp
index 75e643df79..4f1d16d2c5 100644
--- a/src/tools/moc/keywords.cpp
+++ b/src/tools/moc/keywords.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 18fbc977ab..0734a92d5a 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -146,7 +141,7 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments)
{
QStringList allArguments;
allArguments.reserve(arguments.size());
- foreach (const QString &argument, arguments) {
+ for (const QString &argument : arguments) {
// "@file" doesn't start with a '-' so we can't use QCommandLineParser for it
if (argument.startsWith(QLatin1Char('@'))) {
QString optionsFile = argument;
@@ -306,25 +301,30 @@ int runMoc(int argc, char **argv)
if (parser.isSet(forceIncludeOption)) {
moc.noInclude = false;
autoInclude = false;
- foreach (const QString &include, parser.values(forceIncludeOption)) {
+ const auto forceIncludes = parser.values(forceIncludeOption);
+ for (const QString &include : forceIncludes) {
moc.includeFiles.append(QFile::encodeName(include));
defaultInclude = false;
}
}
- foreach (const QString &include, parser.values(prependIncludeOption))
+ const auto prependIncludes = parser.values(prependIncludeOption);
+ for (const QString &include : prependIncludes)
moc.includeFiles.prepend(QFile::encodeName(include));
if (parser.isSet(pathPrefixOption))
moc.includePath = QFile::encodeName(parser.value(pathPrefixOption));
}
- foreach (const QString &path, parser.values(includePathOption))
+ const auto includePaths = parser.values(includePathOption);
+ for (const QString &path : includePaths)
pp.includes += Preprocessor::IncludePath(QFile::encodeName(path));
- foreach (const QString &path, parser.values(macFrameworkOption)) {
+ const auto macFrameworks = parser.values(macFrameworkOption);
+ for (const QString &path : macFrameworks) {
// minimalistic framework support for the mac
Preprocessor::IncludePath p(QFile::encodeName(path));
p.isFrameworkPath = true;
pp.includes += p;
}
- foreach (const QString &arg, parser.values(defineOption)) {
+ const auto defines = parser.values(defineOption);
+ for (const QString &arg : defines) {
QByteArray name = arg.toLocal8Bit();
QByteArray value("1");
int eq = name.indexOf('=');
@@ -341,7 +341,8 @@ int runMoc(int argc, char **argv)
macro.symbols.removeLast(); // remove the EOF symbol
pp.macros.insert(name, macro);
}
- foreach (const QString &arg, parser.values(undefineOption)) {
+ const auto undefines = parser.values(undefineOption);
+ for (const QString &arg : undefines) {
QByteArray macro = arg.toLocal8Bit();
if (macro.isEmpty()) {
error("Missing macro name");
@@ -359,7 +360,7 @@ int runMoc(int argc, char **argv)
int spos = filename.lastIndexOf(QDir::separator());
int ppos = filename.lastIndexOf(QLatin1Char('.'));
// spos >= -1 && ppos > spos => ppos >= 0
- moc.noInclude = (ppos > spos && filename[ppos + 1].toLower() != QLatin1Char('h'));
+ moc.noInclude = (ppos > spos && filename.at(ppos + 1).toLower() != QLatin1Char('h'));
}
if (defaultInclude) {
if (moc.includePath.isEmpty()) {
@@ -386,7 +387,8 @@ int runMoc(int argc, char **argv)
moc.filename = filename.toLocal8Bit();
}
- foreach (const QString &md, parser.values(metadataOption)) {
+ const auto metadata = parser.values(metadataOption);
+ for (const QString &md : metadata) {
int split = md.indexOf(QLatin1Char('='));
QString key = md.left(split);
QString value = md.mid(split + 1);
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 7dd94cdca7..f2efcadad7 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -141,7 +136,7 @@ bool Moc::parseClassHead(ClassDef *def)
} while (test(COMMA));
if (!def->superclassList.isEmpty()
- && knownGadgets.contains(def->superclassList.first().first)) {
+ && knownGadgets.contains(def->superclassList.constFirst().first)) {
// Q_GADGET subclasses are treated as Q_GADGETs
knownGadgets.insert(def->classname, def->qualified);
knownGadgets.insert(def->qualified, def->qualified);
@@ -317,7 +312,7 @@ void Moc::parseFunctionArguments(FunctionDef *def)
}
if (!def->arguments.isEmpty()
- && def->arguments.last().normalizedType == "QPrivateSignal") {
+ && def->arguments.constLast().normalizedType == "QPrivateSignal") {
def->arguments.removeLast();
def->isPrivateSignal = true;
}
@@ -458,9 +453,8 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro)
}
if (scopedFunctionName) {
- QByteArray msg("Function declaration ");
- msg += def->name;
- msg += " contains extra qualification. Ignoring as signal or slot.";
+ const QByteArray msg = "Function declaration " + def->name
+ + " contains extra qualification. Ignoring as signal or slot.";
warning(msg.constData());
return false;
}
@@ -531,9 +525,8 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
def->isConst = test(CONST);
if (scopedFunctionName
&& (def->isSignal || def->isSlot || def->isInvokable)) {
- QByteArray msg("parsemaybe: Function declaration ");
- msg += def->name;
- msg += " contains extra qualification. Ignoring as signal or slot.";
+ const QByteArray msg = "parsemaybe: Function declaration " + def->name
+ + " contains extra qualification. Ignoring as signal or slot.";
warning(msg.constData());
return false;
}
@@ -543,7 +536,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def)
void Moc::parse()
{
- QList<NamespaceDef> namespaceList;
+ QVector<NamespaceDef> namespaceList;
bool templateClass = false;
while (hasNext()) {
Token t = next();
@@ -735,7 +728,7 @@ void Moc::parse()
if (funcDef.isConstructor) {
if ((access == FunctionDef::Public) && funcDef.isInvokable) {
def.constructorList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.constructorList += funcDef;
@@ -748,7 +741,7 @@ void Moc::parse()
def.publicList += funcDef;
if (funcDef.isSlot) {
def.slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.slotList += funcDef;
@@ -757,7 +750,7 @@ void Moc::parse()
++def.revisionedMethods;
} else if (funcDef.isSignal) {
def.signalList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.signalList += funcDef;
@@ -766,7 +759,7 @@ void Moc::parse()
++def.revisionedMethods;
} else if (funcDef.isInvokable) {
def.methodList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def.methodList += funcDef;
@@ -806,9 +799,30 @@ void Moc::parse()
}
}
-static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtContainers)
+static bool any_type_contains(const QVector<PropertyDef> &properties, const QByteArray &pattern)
+{
+ for (const auto &p : properties) {
+ if (p.type.contains(pattern))
+ return true;
+ }
+ return false;
+}
+
+static bool any_arg_contains(const QVector<FunctionDef> &functions, const QByteArray &pattern)
{
- static const QVector<QByteArray> candidates = QVector<QByteArray>()
+ for (const auto &f : functions) {
+ for (const auto &arg : f.arguments) {
+ if (arg.normalizedType.contains(pattern))
+ return true;
+ }
+ }
+ return false;
+}
+
+static QByteArrayList make_candidates()
+{
+ QByteArrayList result;
+ result
#define STREAM_SMART_POINTER(SMART_POINTER) << #SMART_POINTER
QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(STREAM_SMART_POINTER)
#undef STREAM_SMART_POINTER
@@ -816,33 +830,38 @@ static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtC
QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(STREAM_1ARG_TEMPLATE)
#undef STREAM_1ARG_TEMPLATE
;
+ return result;
+}
- for (int i = 0; i < cdef->propertyList.count(); ++i) {
- const PropertyDef &p = cdef->propertyList.at(i);
- foreach (const QByteArray &candidate, candidates) {
- if (p.type.contains(candidate + "<"))
- requiredQtContainers->insert(candidate);
- }
- }
+static QByteArrayList requiredQtContainers(const QVector<ClassDef> &classes)
+{
+ static const QByteArrayList candidates = make_candidates();
+
+ QByteArrayList required;
+ required.reserve(candidates.size());
- QList<FunctionDef> allFunctions = cdef->slotList + cdef->signalList + cdef->methodList;
+ for (const auto &candidate : candidates) {
+ const QByteArray pattern = candidate + '<';
- for (int i = 0; i < allFunctions.count(); ++i) {
- const FunctionDef &f = allFunctions.at(i);
- foreach (const ArgumentDef &arg, f.arguments) {
- foreach (const QByteArray &candidate, candidates) {
- if (arg.normalizedType.contains(candidate + "<"))
- requiredQtContainers->insert(candidate);
+ for (const auto &c : classes) {
+ if (any_type_contains(c.propertyList, pattern) ||
+ any_arg_contains(c.slotList, pattern) ||
+ any_arg_contains(c.signalList, pattern) ||
+ any_arg_contains(c.methodList, pattern)) {
+ required.push_back(candidate);
+ break;
}
}
}
+
+ return required;
}
void Moc::generate(FILE *out)
{
QByteArray fn = filename;
int i = filename.length()-1;
- while (i>0 && filename[i-1] != '/' && filename[i-1] != '\\')
+ while (i > 0 && filename.at(i - 1) != '/' && filename.at(i - 1) != '\\')
--i; // skip path
if (i >= 0)
fn = filename.mid(i);
@@ -858,7 +877,7 @@ void Moc::generate(FILE *out)
includePath += '/';
for (int i = 0; i < includeFiles.size(); ++i) {
QByteArray inc = includeFiles.at(i);
- if (inc[0] != '<' && inc[0] != '"') {
+ if (inc.at(0) != '<' && inc.at(0) != '"') {
if (includePath.size() && includePath != "./")
inc.prepend(includePath);
inc = '\"' + inc + '\"';
@@ -866,7 +885,7 @@ void Moc::generate(FILE *out)
fprintf(out, "#include %s\n", inc.constData());
}
}
- if (classList.size() && classList.first().classname == "Qt")
+ if (classList.size() && classList.constFirst().classname == "Qt")
fprintf(out, "#include <QtCore/qobject.h>\n");
fprintf(out, "#include <QtCore/qbytearray.h>\n"); // For QByteArrayData
@@ -874,19 +893,9 @@ void Moc::generate(FILE *out)
if (mustIncludeQPluginH)
fprintf(out, "#include <QtCore/qplugin.h>\n");
- QSet<QByteArray> requiredQtContainers;
- for (i = 0; i < classList.size(); ++i) {
- findRequiredContainers(&classList[i], &requiredQtContainers);
- }
-
- // after finding the containers, we sort them into a list to avoid
- // non-deterministic behavior which may cause rebuilds unnecessarily.
- QList<QByteArray> requiredContainerList = requiredQtContainers.toList();
- std::sort(requiredContainerList.begin(), requiredContainerList.end());
-
- foreach (const QByteArray &qtContainer, requiredContainerList) {
+ const auto qtContainers = requiredQtContainers(classList);
+ for (const QByteArray &qtContainer : qtContainers)
fprintf(out, "#include <QtCore/%s>\n", qtContainer.constData());
- }
fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n"
@@ -954,7 +963,7 @@ void Moc::parseSlots(ClassDef *def, FunctionDef::Access access)
++def->revisionedMethods;
}
def->slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def->slotList += funcDef;
@@ -1010,7 +1019,7 @@ void Moc::parseSignals(ClassDef *def)
++def->revisionedMethods;
}
def->signalList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def->signalList += funcDef;
@@ -1048,7 +1057,7 @@ void Moc::createPropertyDef(PropertyDef &propDef)
next();
propDef.name = lexem();
while (test(IDENTIFIER)) {
- QByteArray l = lexem();
+ const QByteArray l = lexem();
if (l[0] == 'C' && l == "CONSTANT") {
propDef.constant = true;
continue;
@@ -1121,25 +1130,19 @@ void Moc::createPropertyDef(PropertyDef &propDef)
}
}
if (propDef.read.isNull() && propDef.member.isNull()) {
- QByteArray msg;
- msg += "Property declaration ";
- msg += propDef.name;
- msg += " has no READ accessor function or associated MEMBER variable. The property will be invalid.";
+ const QByteArray msg = "Property declaration " + propDef.name
+ + " has no READ accessor function or associated MEMBER variable. The property will be invalid.";
warning(msg.constData());
}
if (propDef.constant && !propDef.write.isNull()) {
- QByteArray msg;
- msg += "Property declaration ";
- msg += propDef.name;
- msg += " is both WRITEable and CONSTANT. CONSTANT will be ignored.";
+ const QByteArray msg = "Property declaration " + propDef.name
+ + " is both WRITEable and CONSTANT. CONSTANT will be ignored.";
propDef.constant = false;
warning(msg.constData());
}
if (propDef.constant && !propDef.notify.isNull()) {
- QByteArray msg;
- msg += "Property declaration ";
- msg += propDef.name;
- msg += " is both NOTIFYable and CONSTANT. CONSTANT will be ignored.";
+ const QByteArray msg = "Property declaration " + propDef.name
+ + " is both NOTIFYable and CONSTANT. CONSTANT will be ignored.";
propDef.constant = false;
warning(msg.constData());
}
@@ -1185,10 +1188,8 @@ void Moc::parsePluginData(ClassDef *def)
}
}
if (!fi.exists()) {
- QByteArray msg;
- msg += "Plugin Metadata file ";
- msg += lexem();
- msg += " does not exist. Declaration will be ignored";
+ const QByteArray msg = "Plugin Metadata file " + lexem()
+ + " does not exist. Declaration will be ignored";
error(msg.constData());
return;
}
@@ -1201,10 +1202,8 @@ void Moc::parsePluginData(ClassDef *def)
if (!metaData.isEmpty()) {
def->pluginData.metaData = QJsonDocument::fromJson(metaData);
if (!def->pluginData.metaData.isObject()) {
- QByteArray msg;
- msg += "Plugin Metadata file ";
- msg += lexem();
- msg += " does not contain a valid JSON object. Declaration will be ignored";
+ const QByteArray msg = "Plugin Metadata file " + lexem()
+ + " does not contain a valid JSON object. Declaration will be ignored";
warning(msg.constData());
def->pluginData.iid = QByteArray();
return;
@@ -1308,7 +1307,7 @@ void Moc::parseInterfaces(ClassDef *def)
{
next(LPAREN);
while (test(IDENTIFIER)) {
- QList<ClassDef::Interface> iface;
+ QVector<ClassDef::Interface> iface;
iface += ClassDef::Interface(lexem());
while (test(SCOPE)) {
iface.last().className += lexem();
@@ -1384,7 +1383,7 @@ void Moc::parseSlotInPrivate(ClassDef *def, FunctionDef::Access access)
funcDef.access = access;
parseFunction(&funcDef, true);
def->slotList += funcDef;
- while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) {
+ while (funcDef.arguments.size() > 0 && funcDef.arguments.constLast().isDefault) {
funcDef.wasCloned = true;
funcDef.arguments.removeLast();
def->slotList += funcDef;
@@ -1444,7 +1443,7 @@ bool Moc::until(Token target) {
case LPAREN: ++parenCount; break;
case RPAREN: --parenCount; break;
case LANGLE:
- if (parenCount == 0 && braceCount == 0 && parenCount == 0)
+ if (parenCount == 0 && braceCount == 0)
++angleCount;
break;
case RANGLE:
@@ -1501,12 +1500,12 @@ void Moc::checkSuperClasses(ClassDef *def)
if (!knownQObjectClasses.contains(firstSuperclass)) {
// enable once we /require/ include paths
#if 0
- QByteArray msg;
- msg += "Class ";
- msg += def->className;
- msg += " contains the Q_OBJECT macro and inherits from ";
- msg += def->superclassList.value(0);
- msg += " but that is not a known QObject subclass. You may get compilation errors.";
+ const QByteArray msg
+ = "Class "
+ + def->className
+ + " contains the Q_OBJECT macro and inherits from "
+ + def->superclassList.value(0)
+ + " but that is not a known QObject subclass. You may get compilation errors.";
warning(msg.constData());
#endif
return;
@@ -1514,34 +1513,34 @@ void Moc::checkSuperClasses(ClassDef *def)
for (int i = 1; i < def->superclassList.count(); ++i) {
const QByteArray superClass = def->superclassList.at(i).first;
if (knownQObjectClasses.contains(superClass)) {
- QByteArray msg;
- msg += "Class ";
- msg += def->classname;
- msg += " inherits from two QObject subclasses ";
- msg += firstSuperclass;
- msg += " and ";
- msg += superClass;
- msg += ". This is not supported!";
+ const QByteArray msg
+ = "Class "
+ + def->classname
+ + " inherits from two QObject subclasses "
+ + firstSuperclass
+ + " and "
+ + superClass
+ + ". This is not supported!";
warning(msg.constData());
}
if (interface2IdMap.contains(superClass)) {
bool registeredInterface = false;
for (int i = 0; i < def->interfaceList.count(); ++i)
- if (def->interfaceList.at(i).first().className == superClass) {
+ if (def->interfaceList.at(i).constFirst().className == superClass) {
registeredInterface = true;
break;
}
if (!registeredInterface) {
- QByteArray msg;
- msg += "Class ";
- msg += def->classname;
- msg += " implements the interface ";
- msg += superClass;
- msg += " but does not list it in Q_INTERFACES. qobject_cast to ";
- msg += superClass;
- msg += " will not work!";
+ const QByteArray msg
+ = "Class "
+ + def->classname
+ + " implements the interface "
+ + superClass
+ + " but does not list it in Q_INTERFACES. qobject_cast to "
+ + superClass
+ + " will not work!";
warning(msg.constData());
}
}
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 8a0c583cd9..843bdeb794 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -64,6 +59,7 @@ struct Type
Token firstToken;
ReferenceType referenceType;
};
+Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE);
struct EnumDef
{
@@ -72,6 +68,7 @@ struct EnumDef
bool isEnumClass; // c++11 enum class
EnumDef() : isEnumClass(false) {}
};
+Q_DECLARE_TYPEINFO(EnumDef, Q_MOVABLE_TYPE);
struct ArgumentDef
{
@@ -81,6 +78,7 @@ struct ArgumentDef
QByteArray typeNameForCast; // type name to be used in cast from void * in metacall
bool isDefault;
};
+Q_DECLARE_TYPEINFO(ArgumentDef, Q_MOVABLE_TYPE);
struct FunctionDef
{
@@ -94,7 +92,7 @@ struct FunctionDef
QByteArray name;
bool returnTypeIsVolatile;
- QList<ArgumentDef> arguments;
+ QVector<ArgumentDef> arguments;
enum Access { Private, Protected, Public };
Access access;
@@ -117,6 +115,7 @@ struct FunctionDef
int revision;
};
+Q_DECLARE_TYPEINFO(FunctionDef, Q_MOVABLE_TYPE);
struct PropertyDef
{
@@ -135,6 +134,7 @@ struct PropertyDef
}
int revision;
};
+Q_DECLARE_TYPEINFO(PropertyDef, Q_MOVABLE_TYPE);
struct ClassInfoDef
@@ -142,6 +142,7 @@ struct ClassInfoDef
QByteArray name;
QByteArray value;
};
+Q_DECLARE_TYPEINFO(ClassInfoDef, Q_MOVABLE_TYPE);
struct ClassDef {
ClassDef():
@@ -149,16 +150,17 @@ struct ClassDef {
, revisionedMethods(0), revisionedProperties(0), begin(0), end(0){}
QByteArray classname;
QByteArray qualified;
- QList<QPair<QByteArray, FunctionDef::Access> > superclassList;
+ QVector<QPair<QByteArray, FunctionDef::Access> > superclassList;
struct Interface
{
+ Interface() {} // for QVector, don't use
inline explicit Interface(const QByteArray &_className)
: className(_className) {}
QByteArray className;
QByteArray interfaceId;
};
- QList<QList<Interface> >interfaceList;
+ QVector<QVector<Interface> >interfaceList;
bool hasQObject;
bool hasQGadget;
@@ -169,13 +171,13 @@ struct ClassDef {
QJsonDocument metaData;
} pluginData;
- QList<FunctionDef> constructorList;
- QList<FunctionDef> signalList, slotList, methodList, publicList;
+ QVector<FunctionDef> constructorList;
+ QVector<FunctionDef> signalList, slotList, methodList, publicList;
int notifyableProperties;
- QList<PropertyDef> propertyList;
- QList<ClassInfoDef> classInfoList;
+ QVector<PropertyDef> propertyList;
+ QVector<ClassInfoDef> classInfoList;
QMap<QByteArray, bool> enumDeclarations;
- QList<EnumDef> enumList;
+ QVector<EnumDef> enumList;
QMap<QByteArray, QByteArray> flagAliases;
int revisionedMethods;
int revisionedProperties;
@@ -183,12 +185,15 @@ struct ClassDef {
int begin;
int end;
};
+Q_DECLARE_TYPEINFO(ClassDef, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(ClassDef::Interface, Q_MOVABLE_TYPE);
struct NamespaceDef {
QByteArray name;
int begin;
int end;
};
+Q_DECLARE_TYPEINFO(NamespaceDef, Q_MOVABLE_TYPE);
class Moc : public Parser
{
@@ -203,7 +208,7 @@ public:
bool mustIncludeQPluginH;
QByteArray includePath;
QList<QByteArray> includeFiles;
- QList<ClassDef> classList;
+ QVector<ClassDef> classList;
QMap<QByteArray, QByteArray> interface2IdMap;
QList<QByteArray> metaTypes;
// map from class name to fully qualified name
diff --git a/src/tools/moc/moc.pro b/src/tools/moc/moc.pro
index d39749a318..ccd29341d0 100644
--- a/src/tools/moc/moc.pro
+++ b/src/tools/moc/moc.pro
@@ -1,7 +1,12 @@
option(host_build)
CONFIG += force_bootstrap
-DEFINES += QT_MOC QT_NO_CAST_FROM_ASCII QT_NO_CAST_FROM_BYTEARRAY QT_NO_COMPRESS
+DEFINES += \
+ QT_MOC \
+ QT_NO_CAST_FROM_ASCII \
+ QT_NO_CAST_FROM_BYTEARRAY \
+ QT_NO_COMPRESS \
+ QT_NO_FOREACH
include(moc.pri)
HEADERS += qdatetime_p.h
diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp
index 413b3dbe01..fe8bf680fb 100644
--- a/src/tools/moc/mwerks_mac.cpp
+++ b/src/tools/moc/mwerks_mac.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h
index b01aca781d..9f6f074036 100644
--- a/src/tools/moc/mwerks_mac.h
+++ b/src/tools/moc/mwerks_mac.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h
index 744600e6cf..594775ca6b 100644
--- a/src/tools/moc/outputrevision.h
+++ b/src/tools/moc/outputrevision.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp
index 6092e96d0e..b7aefae1ec 100644
--- a/src/tools/moc/parser.cpp
+++ b/src/tools/moc/parser.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h
index 947e472dae..ee8761108b 100644
--- a/src/tools/moc/parser.h
+++ b/src/tools/moc/parser.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -34,9 +29,10 @@
#ifndef PARSER_H
#define PARSER_H
-#include <qstack.h>
#include "symbols.h"
+#include <stack>
+
QT_BEGIN_NAMESPACE
class Parser
@@ -57,7 +53,7 @@ public:
};
QList<IncludePath> includes;
- QStack<QByteArray> currentFilenames;
+ std::stack<QByteArray, QByteArrayList> currentFilenames;
inline bool hasNext() const { return (index < symbols.size()); }
inline Token next() { if (index >= symbols.size()) return NOTOKEN; return symbols.at(index++).token; }
diff --git a/src/tools/moc/ppkeywords.cpp b/src/tools/moc/ppkeywords.cpp
index 0050d0ae18..b94abf8cd8 100644
--- a/src/tools/moc/ppkeywords.cpp
+++ b/src/tools/moc/ppkeywords.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 2b04b678fa..74c75eda5b 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -1,32 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.org>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -156,6 +151,11 @@ bool Preprocessor::skipBranch()
Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocessor::TokenizeMode mode)
{
Symbols symbols;
+ // Preallocate some space to speed up the code below.
+ // The magic divisor value was found by calculating the average ratio between
+ // input size and the final size of symbols.
+ // This yielded a value of 16.x when compiling Qt Base.
+ symbols.reserve(input.size() / 16);
const char *begin = input.constData();
const char *data = begin;
while (*data) {
@@ -208,13 +208,14 @@ Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocesso
// STRING_LITERAL handling in moc
if (!Preprocessor::preprocessOnly
&& !symbols.isEmpty()
- && symbols.last().token == STRING_LITERAL) {
-
- QByteArray newString = symbols.last().unquotedLexem();
- newString += input.mid(lexem - begin + 1, data - lexem - 2);
- newString.prepend('\"');
- newString.append('\"');
- symbols.last() = Symbol(symbols.last().lineNum,
+ && symbols.constLast().token == STRING_LITERAL) {
+
+ const QByteArray newString
+ = '\"'
+ + symbols.constLast().unquotedLexem()
+ + input.mid(lexem - begin + 1, data - lexem - 2)
+ + '\"';
+ symbols.last() = Symbol(symbols.constLast().lineNum,
STRING_LITERAL,
newString);
continue;
@@ -682,7 +683,7 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
if (s.token == WHITESPACE)
continue;
- while (expansion.size() && expansion.last().token == PP_WHITESPACE)
+ while (expansion.size() && expansion.constLast().token == PP_WHITESPACE)
expansion.pop_back();
Symbol next = s;
@@ -695,8 +696,8 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
next = arg.at(0);
}
- if (!expansion.isEmpty() && expansion.last().token == s.token) {
- Symbol last = expansion.last();
+ if (!expansion.isEmpty() && expansion.constLast().token == s.token) {
+ Symbol last = expansion.constLast();
expansion.pop_back();
if (last.token == STRING_LITERAL || s.token == STRING_LITERAL)
@@ -1037,9 +1038,8 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
const int slashPos = include.indexOf('/');
if (slashPos == -1)
continue;
- QByteArray frameworkCandidate = include.left(slashPos);
- frameworkCandidate.append(".framework/Headers/");
- fi.setFile(QString::fromLocal8Bit(QByteArray(p.path + '/' + frameworkCandidate).constData()), QString::fromLocal8Bit(include.mid(slashPos + 1).constData()));
+ fi.setFile(QString::fromLocal8Bit(p.path + '/' + include.left(slashPos) + ".framework/Headers/"),
+ QString::fromLocal8Bit(include.mid(slashPos + 1).constData()));
} else {
fi.setFile(QString::fromLocal8Bit(p.path.constData()), QString::fromLocal8Bit(include.constData()));
}
@@ -1130,12 +1130,12 @@ void Preprocessor::preprocess(const QByteArray &filename, Symbols &preprocessed)
}
// remove trailing whitespace
while (!macro.symbols.isEmpty() &&
- (macro.symbols.last().token == PP_WHITESPACE || macro.symbols.last().token == WHITESPACE))
+ (macro.symbols.constLast().token == PP_WHITESPACE || macro.symbols.constLast().token == WHITESPACE))
macro.symbols.pop_back();
if (!macro.symbols.isEmpty()) {
- if (macro.symbols.first().token == PP_HASHHASH ||
- macro.symbols.last().token == PP_HASHHASH) {
+ if (macro.symbols.constFirst().token == PP_HASHHASH ||
+ macro.symbols.constLast().token == PP_HASHHASH) {
error("'##' cannot appear at either end of a macro expansion");
}
}
@@ -1220,6 +1220,10 @@ Symbols Preprocessor::preprocessed(const QByteArray &filename, QFile *file)
// phase 3: preprocess conditions and substitute macros
Symbols result;
+ // Preallocate some space to speed up the code below.
+ // The magic value was found by logging the final size
+ // and calculating an average when running moc over FOSS projects.
+ result.reserve(file->size() / 300000);
preprocess(filename, result);
mergeStringLiterals(&result);
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index 9c81f86f9c..9a49751eb0 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h
index 5f442e75ed..af5e90e300 100644
--- a/src/tools/moc/symbols.h
+++ b/src/tools/moc/symbols.h
@@ -1,32 +1,27 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/token.cpp b/src/tools/moc/token.cpp
index 79bbb4641a..cf1aa102c7 100644
--- a/src/tools/moc/token.cpp
+++ b/src/tools/moc/token.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h
index 5081055ef5..3557da8aa8 100644
--- a/src/tools/moc/token.h
+++ b/src/tools/moc/token.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/util/generate.sh b/src/tools/moc/util/generate.sh
index 0b1e8d6ebb..3894be1309 100755
--- a/src/tools/moc/util/generate.sh
+++ b/src/tools/moc/util/generate.sh
@@ -1,32 +1,27 @@
#!/bin/sh
#############################################################################
##
-## Copyright (C) 2015 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
##
## This file is the build configuration utility of the Qt Toolkit.
##
-## $QT_BEGIN_LICENSE:LGPL21$
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
-## and conditions see http://www.qt.io/terms-conditions. For further
-## information use the contact form at http://www.qt.io/contact-us.
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
##
-## GNU Lesser General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU Lesser
-## General Public License version 2.1 or version 3 as published by the Free
-## Software Foundation and appearing in the file LICENSE.LGPLv21 and
-## LICENSE.LGPLv3 included in the packaging of this file. Please review the
-## following information to ensure the GNU Lesser General Public License
-## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-##
-## As a special exception, The Qt Company gives you certain additional
-## rights. These rights are described in The Qt Company LGPL Exception
-## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp
index 4041976393..d0f76a4c45 100644
--- a/src/tools/moc/util/generate_keywords.cpp
+++ b/src/tools/moc/util/generate_keywords.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/util/licenseheader.txt b/src/tools/moc/util/licenseheader.txt
index 75cc5f6607..b2b02f82eb 100644
--- a/src/tools/moc/util/licenseheader.txt
+++ b/src/tools/moc/util/licenseheader.txt
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/tools/moc/utils.h b/src/tools/moc/utils.h
index 89d1aadf86..4cb1d90345 100644
--- a/src/tools/moc/utils.h
+++ b/src/tools/moc/utils.h
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**