Fix assert in qCleanupFuncInfo when using QDebug from a lambda with auto
ASSERT: "size_t(i) < size_t(size())" in file qbytearray.h, line 492 due to info being emptied out completely and then the code does while ((info.at(0) == '*') info was empty because the recent fix "that wasn't the function argument list" would exit the loop with pos at end. Incidentally, this change fixes the fact that qCleanupFuncInfo was removing lambdas: main(int, char**)::<lambda()> became main(int, char**):: which was, well, shorted, but weird. Change-Id: Ic7e8f21ea0df7ef96a3f25c4136a727dc0def207 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 056bdef045867dad07066351787b2edb771be569) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
0c9787babd
commit
03ee1e1002
@ -1003,8 +1003,13 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
|
||||
pos = info.size() - 1;
|
||||
if (info.endsWith(']') && !(info.startsWith('+') || info.startsWith('-'))) {
|
||||
while (--pos) {
|
||||
if (info.at(pos) == '[')
|
||||
if (info.at(pos) == '[') {
|
||||
info.truncate(pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (info.endsWith(' ')) {
|
||||
info.chop(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1018,10 +1023,11 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
|
||||
// canonize operator names
|
||||
info.replace("operator ", "operator");
|
||||
|
||||
pos = -1;
|
||||
// remove argument list
|
||||
forever {
|
||||
int parencount = 0;
|
||||
pos = info.lastIndexOf(')');
|
||||
pos = info.lastIndexOf(')', pos);
|
||||
if (pos == -1) {
|
||||
// Don't know how to parse this function name
|
||||
return info;
|
||||
@ -1029,8 +1035,8 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
|
||||
if (info.indexOf('>', pos) != -1
|
||||
|| info.indexOf(':', pos) != -1) {
|
||||
// that wasn't the function argument list.
|
||||
pos = info.size();
|
||||
break;
|
||||
--pos;
|
||||
continue;
|
||||
}
|
||||
|
||||
// find the beginning of the argument list
|
||||
|
@ -625,6 +625,14 @@ void tst_qmessagehandler::cleanupFuncinfo_data()
|
||||
<< "void `void function<Polymorphic<void __cdecl(int *)> >(void)'::`2'::S::f(Polymorphic<void __cdecl(int *)> *)"
|
||||
<< "function(void)'::`2'::S::f";
|
||||
|
||||
QTest::newRow("gcc_lambda_1") << "main(int, char**)::<lambda()>"
|
||||
<< "main(int, char**)::<lambda()>";
|
||||
|
||||
QTest::newRow("gcc_lambda_with_auto_1")
|
||||
<< "SomeClass::someMethod(const QString&, const QString&)::<lambda(auto:57)> [with "
|
||||
"auto:57 = QNetworkReply::NetworkError]"
|
||||
<< "SomeClass::someMethod(const QString&, const QString&)::<lambda(auto:57)>";
|
||||
|
||||
QTest::newRow("objc_1")
|
||||
<< "-[SomeClass someMethod:withArguments:]"
|
||||
<< "-[SomeClass someMethod:withArguments:]";
|
||||
|
Loading…
x
Reference in New Issue
Block a user