diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index f45a321a6a..9b0fbe37b5 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -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) == '[') - info.truncate(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 diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 665da3ff22..0083cf4bfb 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -625,6 +625,14 @@ void tst_qmessagehandler::cleanupFuncinfo_data() << "void `void function >(void)'::`2'::S::f(Polymorphic *)" << "function(void)'::`2'::S::f"; + QTest::newRow("gcc_lambda_1") << "main(int, char**)::" + << "main(int, char**)::"; + + QTest::newRow("gcc_lambda_with_auto_1") + << "SomeClass::someMethod(const QString&, const QString&):: [with " + "auto:57 = QNetworkReply::NetworkError]" + << "SomeClass::someMethod(const QString&, const QString&)::"; + QTest::newRow("objc_1") << "-[SomeClass someMethod:withArguments:]" << "-[SomeClass someMethod:withArguments:]";