logging: Fix qCleanupFuncinfo to not mangle Objective-C message names

Change-Id: I823566ba72668c611d225aa92c4d09a53cabe8fc
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
bb10
Tor Arne Vestbø 2014-10-16 14:11:49 +02:00
parent 0c71cbea54
commit ae89aa330f
2 changed files with 19 additions and 2 deletions

View File

@ -653,9 +653,10 @@ Q_AUTOTEST_EXPORT QByteArray qCleanupFuncinfo(QByteArray info)
int pos;
// skip trailing [with XXX] for templates (gcc)
// Skip trailing [with XXX] for templates (gcc), but make
// sure to not affect Objective-C message names.
pos = info.size() - 1;
if (info.endsWith(']')) {
if (info.endsWith(']') && !(info.startsWith('+') || info.startsWith('-'))) {
while (--pos) {
if (info.at(pos) == '[')
info.truncate(pos);

View File

@ -670,6 +670,22 @@ void tst_qmessagehandler::cleanupFuncinfo_data()
QTest::newRow("gcc_39")
<< "int TestClass1::operator>(int)"
<< "TestClass1::operator>";
QTest::newRow("objc_1")
<< "-[SomeClass someMethod:withArguments:]"
<< "-[SomeClass someMethod:withArguments:]";
QTest::newRow("objc_2")
<< "+[SomeClass withClassMethod:withArguments:]"
<< "+[SomeClass withClassMethod:withArguments:]";
QTest::newRow("objc_3")
<< "-[SomeClass someMethodWithoutArguments]"
<< "-[SomeClass someMethodWithoutArguments]";
QTest::newRow("objc_4")
<< "__31-[SomeClass someMethodSchedulingBlock]_block_invoke"
<< "__31-[SomeClass someMethodSchedulingBlock]_block_invoke";
}
#endif