ocamlPackages.hxd: 0.3.2 -> 0.3.3 (#364231)
[NixPkgs.git] / pkgs / development / python-modules / pyside2 / shiboken2-clang-Write-scope-resolution-for-all-parameters.patch
blobb0be6fa263178736a46dec55401a62541a12d6b0
1 From: Friedemann Kleint <Friedemann.Kleint@qt.io>
2 Date: Thu, 27 Apr 2023 12:18:39 +0200
3 Subject: shiboken2/clang: Write scope resolution for all parameters of native
4 wrappers
6 Make sure types are correct for cases like:
8 - QtDBusHelper::QDBusReply::QDBusReply(::QDBusReply<void>)
9 - Qt3DInput*Event constructors taking the equivalent QtGui classes
10 (Qt3DInput::QMouseEvent(::QMouseEvent *);
12 [ChangeLog][shiboken6] Support for parameters/function return
13 types with scope resolution has been improved.
15 Fixes: PYSIDE-2288
16 Pick-to: 6.5 5.15
17 Change-Id: Id29758fceb88188f4cd834fbd5a7cc0ab511fb1a
18 Reviewed-by: Christian Tismer <tismer@stackless.com>
19 (cherry picked from commit dd863857436bbeeba4c0a1077f5ad16653296277)
20 ---
21 sources/shiboken2/generator/generator.cpp | 24 +++++++++++++-----------
22 1 file changed, 13 insertions(+), 11 deletions(-)
24 diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
25 index 6028282..6147b8a 100644
26 --- a/sources/shiboken2/generator/generator.cpp
27 +++ b/sources/shiboken2/generator/generator.cpp
28 @@ -899,21 +899,23 @@ QString Generator::translateType(const AbstractMetaType *cType,
29 if (index >= (s.size() - (constLen + 1))) // (VarType const) or (VarType const[*|&])
30 s = s.remove(index, constLen);
32 - } else if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) {
33 + } else {
34 AbstractMetaType *copyType = cType->copy();
35 + if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) {
36 + if (options & Generator::ExcludeConst)
37 + copyType->setConstant(false);
39 - if (options & Generator::ExcludeConst)
40 - copyType->setConstant(false);
42 - if (options & Generator::ExcludeReference)
43 - copyType->setReferenceType(NoReference);
45 + if (options & Generator::ExcludeReference)
46 + copyType->setReferenceType(NoReference);
47 + }
48 s = copyType->cppSignature();
49 - if (!copyType->typeEntry()->isVoid() && !copyType->typeEntry()->isCppPrimitive())
50 - s.prepend(QLatin1String("::"));
51 + const auto te = copyType->typeEntry();
52 + if (!te->isVoid() && !te->isCppPrimitive()) { // Add scope resolution
53 + const auto pos = s.indexOf(te->qualifiedCppName()); // Skip const/volatile
54 + Q_ASSERT(pos >= 0);
55 + s.insert(pos, QLatin1String("::"));
56 + }
57 delete copyType;
58 - } else {
59 - s = cType->cppSignature();