moc: Fix asserts on moc on empty token preceding ## operator
Regression introduced in c32ef0a725
The expansion vector can be empty, in that case it is not allowed to
call constLast()
Task-number: QTBUG-55853
Change-Id: I47aa8eb7507ee91662215df42b4a66eebaa32bb5
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
parent
001efe14f2
commit
97710f429f
|
|
@ -696,9 +696,9 @@ Symbols Preprocessor::macroExpandIdentifier(Preprocessor *that, SymbolStack &sym
|
|||
next = arg.at(0);
|
||||
}
|
||||
|
||||
Symbol last = expansion.constLast();
|
||||
if (!expansion.isEmpty() && last.token == s.token && last.token != STRING_LITERAL) {
|
||||
expansion.pop_back();
|
||||
if (!expansion.isEmpty() && expansion.constLast().token == s.token
|
||||
&& expansion.constLast().token != STRING_LITERAL) {
|
||||
Symbol last = expansion.takeLast();
|
||||
|
||||
QByteArray lexem = last.lexem() + next.lexem();
|
||||
expansion += Symbol(lineNum, last.token, lexem);
|
||||
|
|
|
|||
|
|
@ -139,6 +139,9 @@ public slots:
|
|||
signals:
|
||||
DEFINE_CMDLINE_SIGNAL;
|
||||
|
||||
#define QTBUG55853(X) PD_DEFINE1(X, signalQTBUG55853)
|
||||
#define PD_EMPTY /* empty */
|
||||
void QTBUG55853(PD_EMPTY)();
|
||||
};
|
||||
|
||||
#undef QString
|
||||
|
|
|
|||
|
|
@ -3397,6 +3397,9 @@ void tst_Moc::parseDefines()
|
|||
|
||||
index = mo->indexOfSignal("cmdlineSignal(QMap<int,int>)");
|
||||
QVERIFY(index != -1);
|
||||
|
||||
index = mo->indexOfSignal("signalQTBUG55853()");
|
||||
QVERIFY(index != -1);
|
||||
}
|
||||
|
||||
void tst_Moc::preprocessorOnly()
|
||||
|
|
|
|||
Loading…
Reference in New Issue