aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/abstractmetalang.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-03-19 17:24:00 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-04-19 12:51:14 +0000
commitfb7386c18c15ca83aebe8f973c1b018d016baaa9 (patch)
tree91f0c2988af2e4133a2fdc702fccce69a623b9bf /sources/shiboken2/ApiExtractor/abstractmetalang.h
parenta89690409972501741c846ac8ad4a499f2982809 (diff)
shiboken: Use enum values from Clang
Remove a lot of ugly value parsing code in favor of clang_getEnumConstantDeclValue() and clang_getEnumConstantDeclUnsignedValue() depending on the type. Introduce a class EnumValue containing a union of qint64 and quint64 values to represent signed/unsigned values correctly and use that in the code model and meta language classes. Change-Id: If2efb7cfd560237907678b8f6fdfb0bc689c0c93 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.h')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index c51f7704b..7e0bfa322 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -34,6 +34,7 @@
#include "typesystem_typedefs.h"
#include "parser/codemodel_enums.h"
+#include "parser/enumvalue.h"
#include <QtCore/qobjectdefs.h>
#include <QtCore/QStringList>
@@ -1090,12 +1091,12 @@ class AbstractMetaEnumValue
public:
AbstractMetaEnumValue() {}
- int value() const
+ EnumValue value() const
{
return m_value;
}
- void setValue(int value)
+ void setValue(EnumValue value)
{
m_value = value;
}
@@ -1134,7 +1135,7 @@ private:
QString m_name;
QString m_stringValue;
- int m_value = 0;
+ EnumValue m_value;
Documentation m_doc;
};
@@ -1204,6 +1205,9 @@ public:
m_class = c;
}
+ bool isSigned() const { return m_signed; }
+ void setSigned(bool s) { m_signed = s; }
+
private:
AbstractMetaEnumValueList m_enumValues;
EnumTypeEntry *m_typeEntry = nullptr;
@@ -1211,6 +1215,7 @@ private:
EnumKind m_enumKind = CEnum;
uint m_hasQenumsDeclaration : 1;
+ uint m_signed : 1;
};
#ifndef QT_NO_DEBUG_STREAM