summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-05-26 13:33:42 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-05-27 09:21:08 +0200
commitd8a2456fbf18f60e2d1950585d93aa530df077bf (patch)
tree4b16d1790e7a99039e0217f9f6bad2b8dfd4f2ce /tests/auto/tools
parent370324f6e2f3ce7d250a1c3686918c08da1f8b06 (diff)
moc: handle include directives in enums
When including files, moc inserts a MOC_INCLUDE_BEGIN and MOC_INCLUDE_END token into the token stream. Those are already handled in the toplevel Moc::parse function, but parseEnum lacked support so far. Pick-to: 5.15 Fixes: QTBUG-80578 Change-Id: I35c8fd959347d94af20090b3a505dd9e6bfaff88 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/allmocs_baseline_in.json17
-rw-r--r--tests/auto/tools/moc/enum_inc.h1
-rw-r--r--tests/auto/tools/moc/enum_with_include.h39
-rw-r--r--tests/auto/tools/moc/moc.pro2
4 files changed, 59 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/allmocs_baseline_in.json b/tests/auto/tools/moc/allmocs_baseline_in.json
index 77647329c9..94593b1ef8 100644
--- a/tests/auto/tools/moc/allmocs_baseline_in.json
+++ b/tests/auto/tools/moc/allmocs_baseline_in.json
@@ -713,6 +713,23 @@
{
"classes": [
{
+ "className": "Foo",
+ "object": true,
+ "qualifiedClassName": "Foo",
+ "superClasses": [
+ {
+ "access": "public",
+ "name": "QObject"
+ }
+ ]
+ }
+ ],
+ "inputFile": "enum_with_include.h",
+ "outputRevision": 67
+ },
+ {
+ "classes": [
+ {
"classInfos": [
{
"name": "Test",
diff --git a/tests/auto/tools/moc/enum_inc.h b/tests/auto/tools/moc/enum_inc.h
new file mode 100644
index 0000000000..32eec283e4
--- /dev/null
+++ b/tests/auto/tools/moc/enum_inc.h
@@ -0,0 +1 @@
+parcel
diff --git a/tests/auto/tools/moc/enum_with_include.h b/tests/auto/tools/moc/enum_with_include.h
new file mode 100644
index 0000000000..b8abf77f12
--- /dev/null
+++ b/tests/auto/tools/moc/enum_with_include.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef ENUM_WITH_INCLUDE_H
+#define ENUM_WITH_INCLUDE_H
+#include <QtCore/QObject>
+
+class Foo : public QObject {
+ enum en {
+ #include <enum_inc.h>
+ };
+ Q_OBJECT
+};
+#endif
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index 094c76227b..693a2ab2f9 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -31,11 +31,13 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
related-metaobjects-name-conflict.h \
namespace.h cxx17-namespaces.h \
cxx-attributes.h \
+ enum_inc.h enum_with_include.h \
moc_include.h
# No platform specifics in the JSON files, so that we can compare them
JSON_HEADERS = $$HEADERS
JSON_HEADERS -= cxx-attributes.h
+JSON_HEADERS -= enum_inc.h
if(*-g++*|*-icc*|*-clang*|*-llvm):!win32-*: HEADERS += os9-newlines.h win-newlines.h
if(*-g++*|*-clang*): HEADERS += dollars.h