summaryrefslogtreecommitdiffstats
path: root/src/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 12:13:13 +0200
commit98cb33115089eebccb3f0b7ed46397465a942855 (patch)
treeea99656093713e8456d14ee1c77873f4ab9befc6 /src/tools
parent076299dfe3c243899cf708d870ec41f3e1401af5 (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: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/tools')
-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 9dbc22dc2c..edc72f0869 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -281,11 +281,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);