handle even more include in enum cases

The solution in d3ed7dac8aa2f4ede0c409254b9dd44842086be0 was needlessly
complicated, and broke a valid use case.
The issue of no identifier being available to parse after the include
has been processed can instead be solved by moving the test for the
closing brace after the include processing.
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=87973325f1b99f2b
Last-Update: 2022-04-07

Gbp-Pq: Name moc_handle_include.diff
This commit is contained in:
Debian Qt/KDE Maintainers 2022-05-14 17:41:01 +08:00 committed by openKylinBot
parent ba37f387b4
commit db597cc481
2 changed files with 6 additions and 2 deletions

View File

@ -305,10 +305,9 @@ bool Moc::parseEnum(EnumDef *def)
return IncludeState::NoInclude;
};
do {
handleInclude();
if (lookup() == RBRACE) // accept trailing comma
break;
if ( handleInclude() == IncludeState::IncludeEnd)
continue;
next(IDENTIFIER);
def->values += lexem();
handleInclude();

View File

@ -34,6 +34,11 @@ class Foo : public QObject {
enum en {
#include <enum_inc.h>
};
enum class en2 {
#include <enum_inc.h>
reference = 42
};
Q_OBJECT
};
#endif