aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-06 11:08:42 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-04-05 14:36:35 +0000
commit20ee6a3c6d9cbc5a364eebd9a2eb96ea59850351 (patch)
treec0a764c89046a407c1c603512b7fd82febaeee72
parent9abbb0d49556bae1507456e20509137d01abe457 (diff)
ShibokenGenerator::guessScopeForDefaultValue() Do not qualify macros
Simple macros are not expanded by Clang, so, qualifying them should be avoided. The code has been observed to trigger for "ULONG_MAX", "USHRT_MAX" and "GL_UNSIGNED_SHORT". Task-number: PYSIDE-323 Change-Id: Ic5c3a0c6e7e4c78b2d62e032e4172702b357eb68 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--generator/shiboken2/shibokengenerator.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/generator/shiboken2/shibokengenerator.cpp b/generator/shiboken2/shibokengenerator.cpp
index be39143..b1edc66 100644
--- a/generator/shiboken2/shibokengenerator.cpp
+++ b/generator/shiboken2/shibokengenerator.cpp
@@ -437,6 +437,12 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction*
return value;
static QRegExp enumValueRegEx(QLatin1String("^([A-Za-z_]\\w*)?$"));
+ // Do not qualify macros by class name, eg QSGGeometry(..., int t = GL_UNSIGNED_SHORT);
+ static QRegExp macroRegEx(QLatin1String("^[A-Z_][A-Z0-9_]*$"));
+ Q_ASSERT(macroRegEx.isValid());
+ if (arg->type()->isPrimitive() && macroRegEx.exactMatch(value))
+ return value;
+
QString prefix;
QString suffix;