aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-09-04 15:01:59 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-09-04 14:04:32 +0000
commit182edcee26e49f7caebf6b30fd1b1d9469a48e4e (patch)
tree116c22cf051053b8c779e510c108229d3903d684
parent7fa1f9316f1cd0b5fba3f59e9edd14be90db9fd4 (diff)
shiboken2: Make message about unmatched functions more verbose
List all member functions if a candidate cannot be found (spelling error or similar). Change-Id: I86ca1556078051d2fc1f78f2091f5176f2a65423 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 64c482c54..b235d9bd9 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -163,6 +163,27 @@ QSet<QString> AbstractMetaBuilder::qtMetaTypeDeclaredTypeNames() const
return d->m_qmetatypeDeclaredTypenames;
}
+static QString msgNoFunctionForModification(const QString &signature, const QString &className,
+ const QStringList &possibleSignatures,
+ const AbstractMetaFunctionList &allFunctions)
+{
+ QString result;
+ QTextStream str(&result);
+ str << "signature '" << signature << "' for function modification in '"
+ << className << "' not found.";
+ if (possibleSignatures.isEmpty()) {
+ str << " No candidates were found. Member functions: ";
+ for (int f = 0, size = allFunctions.size(); f < size; ++f) {
+ if (f)
+ str << ", ";
+ str << allFunctions.at(f)->minimalSignature();
+ }
+ } else {
+ str << " Possible candidates: " << possibleSignatures.join(QLatin1String(", "));
+ }
+ return result;
+}
+
void AbstractMetaBuilderPrivate::checkFunctionModifications()
{
TypeDatabase *types = TypeDatabase::instance();
@@ -206,8 +227,8 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
if (!found) {
qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("signature '%1' for function modification in '%2' not found. Possible candidates: %3")
- .arg(signature, clazz->qualifiedCppName(), possibleSignatures.join(QLatin1String(", ")));
+ << msgNoFunctionForModification(signature, clazz->qualifiedCppName(),
+ possibleSignatures, functions);
}
}
}