summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/moc.cpp
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 /src/tools/moc/moc.cpp
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 'src/tools/moc/moc.cpp')
-rw-r--r--src/tools/moc/moc.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index dbe75ebe51..f04f4c5d0d 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -261,11 +261,21 @@ bool Moc::parseEnum(EnumDef *def)
}
if (!test(LBRACE))
return false;
+ auto handleInclude = [this]() {
+ if (test(MOC_INCLUDE_BEGIN))
+ currentFilenames.push(symbol().unquotedLexem());
+ if (test(NOTOKEN)) {
+ next(MOC_INCLUDE_END);
+ currentFilenames.pop();
+ }
+ };
do {
if (lookup() == RBRACE) // accept trailing comma
break;
+ handleInclude();
next(IDENTIFIER);
def->values += lexem();
+ handleInclude();
skipCxxAttributes();
} while (test(EQ) ? until(COMMA) : test(COMMA));
next(RBRACE);