aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-02-27 09:19:24 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-02-27 09:53:40 +0100
commit8fc33607461cdb697ba607ac3d74dd37c14479e6 (patch)
tree7934eaec4d31ecf1fafd975d99c8b86c553fadfd /sources/shiboken6/generator/shiboken/cppgenerator.cpp
parentff40e74847cae1e746fc857597209294ca2c2568 (diff)
shiboken6: Mangle field name "from"
Fixes: PYSIDE-2237 Pick-to: 6.4 Change-Id: I9993bbaf545e2868a5be900f793e5ae23f17235f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index 34fa0cff7..c26d06999 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -55,6 +55,13 @@
using namespace Qt::StringLiterals;
+static QString mangleName(QString name)
+{
+ if (name == u"None" || name == u"False" || name == u"True" || name == u"from")
+ name += u'_';
+ return name;
+}
+
struct sbkUnusedVariableCast
{
explicit sbkUnusedVariableCast(QString name) : m_name(name) {}
@@ -472,7 +479,7 @@ static QString BuildEnumFlagInfo(const AbstractMetaEnum &cppEnum)
static void writePyGetSetDefEntry(TextStream &s, const QString &name,
const QString &getFunc, const QString &setFunc)
{
- s << "{const_cast<char *>(\"" << name << "\"), " << getFunc << ", "
+ s << "{const_cast<char *>(\"" << mangleName(name) << "\"), " << getFunc << ", "
<< (setFunc.isEmpty() ? NULL_PTR : setFunc) << ", nullptr, nullptr},\n";
}
@@ -5673,13 +5680,6 @@ void CppGenerator::writeEnumsInitialization(TextStream &s, AbstractMetaEnumList
}
}
-static QString mangleName(QString name)
-{
- if (name == u"None" || name == u"False" || name == u"True")
- name += u'_';
- return name;
-}
-
void CppGenerator::writeEnumInitialization(TextStream &s, const AbstractMetaEnum &cppEnum,
ErrorReturn errorReturn) const
{