aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
diff options
context:
space:
mode:
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
{