aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-11 11:19:42 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-13 17:19:35 +0200
commitf1796628ec2d81c656876876148b2bf5db47c472 (patch)
treef86b528c1783a51bcdda244fe08aae3f9d9987dd /sources/shiboken2/ApiExtractor
parent035a2991c9468bdaad961da11053cf4176791819 (diff)
shiboken: Improve handling of pointer types for CONVERTTOCPP in injected code
Code snippets like: QByteArray *cppSelf = %CONVERTTOCPP[QByteArray *](obj); cause an assert in shiboken since the '*' is captured into the target of the assignment and is not considered part of the type. Make the error message a bit clearer and add documentation. Fixes: PYSIDE-1037 Change-Id: Ie8da2f57ba91325ea677e1a00852e91726c0e09b Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r--sources/shiboken2/ApiExtractor/messages.cpp17
-rw-r--r--sources/shiboken2/ApiExtractor/messages.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/messages.cpp b/sources/shiboken2/ApiExtractor/messages.cpp
index a6e75aac3..5b3a57fcc 100644
--- a/sources/shiboken2/ApiExtractor/messages.cpp
+++ b/sources/shiboken2/ApiExtractor/messages.cpp
@@ -311,6 +311,23 @@ QString msgCannotUseEnumAsInt(const QString &name)
"Compilation errors may occur when used as a function argument.");
}
+QString msgConversionTypesDiffer(const QString &varType, const QString &conversionType)
+{
+ QString result;
+ QTextStream str(&result);
+ str << "Types of receiver variable ('" << varType
+ << "') and %%CONVERTTOCPP type system variable ('" << conversionType
+ << "') differ";
+ QString strippedVarType = varType;
+ QString strippedConversionType = conversionType;
+ TypeInfo::stripQualifiers(&strippedVarType);
+ TypeInfo::stripQualifiers(&strippedConversionType);
+ if (strippedVarType == strippedConversionType)
+ str << " in qualifiers. Please make sure the type is a distinct token";
+ str << '.';
+ return result;
+}
+
// main.cpp
QString msgLeftOverArguments(const QMap<QString, QString> &remainingArgs)
diff --git a/sources/shiboken2/ApiExtractor/messages.h b/sources/shiboken2/ApiExtractor/messages.h
index ab2bf64b6..2fee0de8f 100644
--- a/sources/shiboken2/ApiExtractor/messages.h
+++ b/sources/shiboken2/ApiExtractor/messages.h
@@ -115,6 +115,8 @@ QString msgCannotOpenForWriting(const QFile &f);
QString msgCannotUseEnumAsInt(const QString &name);
+QString msgConversionTypesDiffer(const QString &varType, const QString &conversionType);
+
QString msgLeftOverArguments(const QMap<QString, QString> &remainingArgs);
QString msgInvalidVersion(const QString &package, const QString &version);