diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-04-24 16:02:01 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-04-26 14:36:53 +0000 |
commit | 54cc52d16ccd0c6350823a1cfcc0154c1a1f543b (patch) | |
tree | fdb8f37aac6ef81622cb765d0ec6371d186d9c6a | |
parent | 00c61832d70f39438b8a60292786650b78d97357 (diff) |
shiboken: Output class name in warnings about wrong index
Change-Id: I64bf848858fa07a27fc357d83ff99c8d3f94ba91
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | generator/shiboken2/shibokengenerator.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/generator/shiboken2/shibokengenerator.cpp b/generator/shiboken2/shibokengenerator.cpp index ffce283..2dd8f06 100644 --- a/generator/shiboken2/shibokengenerator.cpp +++ b/generator/shiboken2/shibokengenerator.cpp @@ -1647,6 +1647,17 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s, s << INDENT << "// End of code injection" << endl; } +static QString msgWrongIndex(const char *varName, const QString &capture, const AbstractMetaFunction *func) +{ + QString result; + QTextStream str(&result); + str << "Wrong index for " << varName << " variable (" << capture << ") on "; + if (const AbstractMetaClass *c = func->implementingClass()) + str << c->name() << "::"; + str << func->signature(); + return result; +} + void ShibokenGenerator::writeCodeSnips(QTextStream& s, const CodeSnipList& codeSnips, TypeSystem::CodeSnipPosition position, @@ -1682,8 +1693,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s, const QRegularExpressionMatch match = pyArgsRegexCheck.match(code); if (match.hasMatch()) { qCWarning(lcShiboken).noquote().nospace() - << "Wrong index for %PYARG variable (" << match.captured(1) - << ") on " << func->signature(); + << msgWrongIndex("%PYARG", match.captured(1), func); return; } code.replace(QLatin1String("%PYARG_1"), QLatin1String(PYTHON_ARG)); @@ -1711,8 +1721,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s, while (rit.hasNext()) { QRegularExpressionMatch match = rit.next(); qCWarning(lcShiboken).noquote().nospace() - << "Wrong index for %ARG#_TYPE variable (" << match.captured(1) - << ") on " << func->signature(); + << msgWrongIndex("%ARG#_TYPE", match.captured(1), func); } // Replace template variable for return variable name. |