aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-06 13:07:21 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-07-06 13:32:51 +0000
commitd23b43816a7ed6a9513b2213a7e633eed2155769 (patch)
tree0bdcb02176e6620b2c55306eb44c191d8109f634 /sources/shiboken2
parent41dc5daf2e622ceb9cdf567f749fa103014042ee (diff)
parente2805675caca2f275f7074e94e3cf04de55f0b3a (diff)
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp17
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp24
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h9
-rw-r--r--sources/shiboken2/libshiboken/sbkpython.h6
5 files changed, 56 insertions, 2 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index e95cf202b..340ed846a 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -1913,7 +1913,7 @@ bool AbstractMetaBuilderPrivate::setArrayArgumentType(AbstractMetaFunction *func
AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModelItem functionItem)
{
- if (!functionItem->templateParameters().isEmpty())
+ if (functionItem->isDeleted() || !functionItem->templateParameters().isEmpty())
return nullptr;
QString functionName = functionItem->name();
QString className;
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index 5192e9e76..af7f96068 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -260,6 +260,18 @@ FunctionModelItem BuilderPrivate::createFunction(const CXCursor &cursor,
result->setFunctionType(t);
result->setScope(m_scope);
result->setStatic(clang_Cursor_getStorageClass(cursor) == CX_SC_Static);
+ switch (clang_getCursorAvailability(cursor)) {
+ case CXAvailability_Available:
+ break;
+ case CXAvailability_Deprecated:
+ result->setDeprecated(true);
+ break;
+ case CXAvailability_NotAvailable: // "Foo(const Foo&) = delete;"
+ result->setDeleted(true);
+ break;
+ case CXAvailability_NotAccessible:
+ break;
+ }
return result;
}
@@ -729,7 +741,6 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
d->m_currentEnum->setSigned(isSigned(clang_getEnumDeclIntegerType(cursor).kind));
if (!qSharedPointerDynamicCast<_ClassModelItem>(d->m_scopeStack.back()).isNull())
d->m_currentEnum->setAccessPolicy(accessPolicy(clang_getCXXAccessSpecifier(cursor)));
- d->m_scopeStack.back()->addEnum(d->m_currentEnum);
}
break;
case CXCursor_EnumConstantDecl: {
@@ -912,6 +923,10 @@ bool Builder::endToken(const CXCursor &cursor)
d->m_currentFunctionType = CodeModel::Normal;
break;
case CXCursor_EnumDecl:
+ // Add enum only if values were encountered, otherwise assume it
+ // is a forward declaration of an enum class.
+ if (!d->m_currentEnum.isNull() && d->m_currentEnum->hasValues())
+ d->m_scopeStack.back()->addEnum(d->m_currentEnum);
d->m_currentEnum.clear();
break;
case CXCursor_VarDecl:
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
index 60a699337..d862692dd 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
@@ -896,6 +896,26 @@ void _FunctionModelItem::setVariadics(bool isVariadics)
m_isVariadics = isVariadics;
}
+bool _FunctionModelItem::isDeleted() const
+{
+ return m_isDeleted;
+}
+
+void _FunctionModelItem::setDeleted(bool d)
+{
+ m_isDeleted = d;
+}
+
+bool _FunctionModelItem::isDeprecated() const
+{
+ return m_isDeprecated;
+}
+
+void _FunctionModelItem::setDeprecated(bool d)
+{
+ m_isDeprecated = d;
+}
+
bool _FunctionModelItem::isVirtual() const
{
return m_isVirtual;
@@ -972,12 +992,16 @@ void _FunctionModelItem::formatDebug(QDebug &d) const
{
_MemberModelItem::formatDebug(d);
d << ", type=" << m_functionType;
+ if (m_isDeleted)
+ d << " [deleted!]";
if (m_isInline)
d << " [inline]";
if (m_isVirtual)
d << " [virtual]";
if (m_isOverride)
d << " [override]";
+ if (m_isDeprecated)
+ d << " [deprecated]";
if (m_isFinal)
d << " [final]";
if (m_isAbstract)
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h
index d93aa10d9..ac1fe26c1 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.h
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h
@@ -552,6 +552,12 @@ public:
CodeModel::FunctionType functionType() const;
void setFunctionType(CodeModel::FunctionType functionType);
+ bool isDeleted() const;
+ void setDeleted(bool d);
+
+ bool isDeprecated() const;
+ void setDeprecated(bool d);
+
bool isVirtual() const;
void setVirtual(bool isVirtual);
@@ -587,9 +593,11 @@ private:
CodeModel::FunctionType m_functionType;
union {
struct {
+ uint m_isDeleted: 1;
uint m_isVirtual: 1;
uint m_isOverride: 1;
uint m_isFinal: 1;
+ uint m_isDeprecated: 1;
uint m_isInline: 1;
uint m_isAbstract: 1;
uint m_isExplicit: 1;
@@ -646,6 +654,7 @@ public:
CodeModel::AccessPolicy accessPolicy() const;
void setAccessPolicy(CodeModel::AccessPolicy accessPolicy);
+ bool hasValues() const { return !m_enumerators.isEmpty(); }
EnumeratorList enumerators() const;
void addEnumerator(EnumeratorModelItem item);
diff --git a/sources/shiboken2/libshiboken/sbkpython.h b/sources/shiboken2/libshiboken/sbkpython.h
index a26c318d1..fbac016eb 100644
--- a/sources/shiboken2/libshiboken/sbkpython.h
+++ b/sources/shiboken2/libshiboken/sbkpython.h
@@ -71,6 +71,12 @@
#define PyInt_AsSsize_t(x) PyLong_AsSsize_t(x)
#define PyString_Type PyUnicode_Type
+ // In Python 3, Py_TPFLAGS_DEFAULT contains Py_TPFLAGS_HAVE_VERSION_TAG,
+ // which will trigger the attribute cache, which is not intended in Qt for Python.
+ // Use a customized Py_TPFLAGS_DEFAULT by defining Py_TPFLAGS_HAVE_VERSION_TAG = 0.
+ #undef Py_TPFLAGS_HAVE_VERSION_TAG
+ #define Py_TPFLAGS_HAVE_VERSION_TAG (0)
+
#else
// Note: if there wasn't for the old-style classes, only a PyNumber_Check would suffice.
#define SbkNumber_Check(X) \