aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-06 12:51:24 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-06-06 16:12:35 +0200
commitfd126b28e1d9b02ea16c813bc392461bdb05bd1d (patch)
tree63066d241027f67dcf58132dad4d70226af7a2a3 /sources/shiboken2/ApiExtractor
parentf7f12ba7f277d4c074382b5434123dc66b8791b8 (diff)
shiboken: Fix generation of init functions and types for const-refs of smart pointers
Add a convenience to strip all qualifiers and use that. This at least fixes the naming (for example, getInitFunctionName returning "const_QSharedPointer_QSize___&"), the init function for the type itself is missing, though. Task-number: PYSIDE-1016 Change-Id: Id61b3c879199fc061e2846007951e3e9c82b85c4 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp11
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
index eb0f44689..7bb7e0a83 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
@@ -353,6 +353,17 @@ bool TypeInfo::stripLeadingQualifier(const QString &qualifier, QString *s)
return true;
}
+// Strip all const/volatile/*/&
+void TypeInfo::stripQualifiers(QString *s)
+{
+ stripLeadingConst(s);
+ stripLeadingVolatile(s);
+ while (s->endsWith(QLatin1Char('&')) || s->endsWith(QLatin1Char('*'))
+ || s->endsWith(QLatin1Char(' '))) {
+ s->chop(1);
+ }
+}
+
// Helper functionality to simplify a raw standard type as returned by
// clang_getCanonicalType() for g++ standard containers from
// "std::__cxx11::list<int, std::allocator<int> >" or
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h
index 3bce5e216..6f3c17613 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.h
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h
@@ -213,6 +213,7 @@ public:
static bool stripLeadingConst(QString *s);
static bool stripLeadingVolatile(QString *s);
static bool stripLeadingQualifier(const QString &qualifier, QString *s);
+ static void stripQualifiers(QString *s);
void simplifyStdType();