aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-06 10:42:05 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-06 11:17:34 +0000
commitb20dfab4bc9a4887160e359b8d23dd25760ff948 (patch)
tree8c610279530feaf5a526495e4a8431c55ee1012a
parent5dec41a724e9967c27eec0a7a0bc36a0b718d310 (diff)
shiboken: Fix handling of deleted functions
Check the cursor availability to detect deleted functions. This fixes the build of the Qt 5.12 API, which for the first time has a Q_DISABLE(QCBorStreamReader) in a public section, causing a copy constructor to be reported. Task-number: PYSIDE-487 Change-Id: I31ba0103cf612a4238c0e282ffcfeeab29df97d1 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp12
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp24
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h8
4 files changed, 45 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index c879727c3..84c116708 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 b2dd7c844..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;
}
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 20f513e1e..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;