aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystemparser.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-22 08:22:42 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-22 08:22:42 +0200
commit17a20f95151368a3b92b949b905325865643ca45 (patch)
tree2271f52498f0dfe7bac57888af7c56b85c3d9e02 /sources/shiboken2/ApiExtractor/typesystemparser.cpp
parent98eb59226aca550ae086c00b9c8023f47c44d2b2 (diff)
parent936cc4c72e2393ed59e05dca1100150d88b52645 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typesystemparser.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.cpp b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
index 948a28796..df36689ed 100644
--- a/sources/shiboken2/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
@@ -76,6 +76,7 @@ static inline QString invalidateAfterUseAttribute() { return QStringLiteral("inv
static inline QString locationAttribute() { return QStringLiteral("location"); }
static inline QString modifiedTypeAttribute() { return QStringLiteral("modified-type"); }
static inline QString modifierAttribute() { return QStringLiteral("modifier"); }
+static inline QString overloadNumberAttribute() { return QStringLiteral("overload-number"); }
static inline QString ownershipAttribute() { return QStringLiteral("owner"); }
static inline QString packageAttribute() { return QStringLiteral("package"); }
static inline QString positionAttribute() { return QStringLiteral("position"); }
@@ -2154,6 +2155,18 @@ bool TypeSystemParser::parseModifyField(const QXmlStreamReader &reader,
return true;
}
+static bool parseOverloadNumber(const QXmlStreamAttribute &attribute, int *overloadNumber,
+ QString *errorMessage)
+{
+ bool ok;
+ *overloadNumber = attribute.value().toInt(&ok);
+ if (!ok || *overloadNumber < 0) {
+ *errorMessage = msgInvalidAttributeValue(attribute);
+ return false;
+ }
+ return true;
+}
+
bool TypeSystemParser::parseAddFunction(const QXmlStreamReader &,
const StackElement &topElement,
QXmlStreamAttributes *attributes)
@@ -2167,6 +2180,7 @@ bool TypeSystemParser::parseAddFunction(const QXmlStreamReader &,
QString returnType = QLatin1String("void");
bool staticFunction = false;
QString access;
+ int overloadNumber = TypeSystem::OverloadNumberUnset;
for (int i = attributes->size() - 1; i >= 0; --i) {
const auto name = attributes->at(i).qualifiedName();
if (name == QLatin1String("signature")) {
@@ -2178,6 +2192,9 @@ bool TypeSystemParser::parseAddFunction(const QXmlStreamReader &,
staticAttribute(), false);
} else if (name == accessAttribute()) {
access = attributes->takeAt(i).value().toString();
+ } else if (name == overloadNumberAttribute()) {
+ if (!parseOverloadNumber(attributes->takeAt(i), &overloadNumber, &m_error))
+ return false;
}
}
@@ -2213,6 +2230,7 @@ bool TypeSystemParser::parseAddFunction(const QXmlStreamReader &,
m_contextStack.top()->functionMods.size();
FunctionModification mod;
+ mod.setOverloadNumber(overloadNumber);
if (!mod.setSignature(m_currentSignature, &m_error))
return false;
mod.setOriginalSignature(originalSignature);
@@ -2237,6 +2255,7 @@ bool TypeSystemParser::parseModifyFunction(const QXmlStreamReader &reader,
QString association;
bool deprecated = false;
bool isThread = false;
+ int overloadNumber = TypeSystem::OverloadNumberUnset;
TypeSystem::ExceptionHandling exceptionHandling = TypeSystem::ExceptionHandling::Unspecified;
TypeSystem::AllowThread allowThread = TypeSystem::AllowThread::Unspecified;
for (int i = attributes->size() - 1; i >= 0; --i) {
@@ -2273,6 +2292,9 @@ bool TypeSystemParser::parseModifyFunction(const QXmlStreamReader &reader,
qCWarning(lcShiboken, "%s",
qPrintable(msgInvalidAttributeValue(attribute)));
}
+ } else if (name == overloadNumberAttribute()) {
+ if (!parseOverloadNumber(attributes->takeAt(i), &overloadNumber, &m_error))
+ return false;
} else if (name == virtualSlotAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
@@ -2296,6 +2318,7 @@ bool TypeSystemParser::parseModifyFunction(const QXmlStreamReader &reader,
return false;
mod.setOriginalSignature(originalSignature);
mod.setExceptionHandling(exceptionHandling);
+ mod.setOverloadNumber(overloadNumber);
m_currentSignature = signature;
if (!access.isEmpty()) {