aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-17 13:23:26 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-19 15:07:49 +0000
commit7e94cd36121d4060d673c7307514e255851b7f1c (patch)
tree3f2ff7a37478b4893b8110b73eb5b627e3fb406c /sources
parente347bb13921420a3d6ac62d620600f97ddcb8b3d (diff)
Shiboken: Handle private abstract methods
Remove the exclusion. Required for Qt3dExtras::QAbstractCameraController::moveCamera() in 5.10. Task-number: PYSIDE-487 Change-Id: I67ae24d4cda2d90ac30c97f77457c2eaf65099ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp5
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp5
-rw-r--r--sources/shiboken2/tests/libother/otherderived.cpp3
-rw-r--r--sources/shiboken2/tests/libother/otherderived.h3
-rw-r--r--sources/shiboken2/tests/libsample/abstract.h1
-rw-r--r--sources/shiboken2/tests/libsample/derived.cpp6
-rw-r--r--sources/shiboken2/tests/libsample/derived.h3
7 files changed, 22 insertions, 4 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 392f5b66d..838770e89 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -341,8 +341,9 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
const AbstractMetaFunctionList &funcs = filterFunctions(metaClass);
for (const AbstractMetaFunction *func : funcs) {
- if ((func->isPrivate() && !visibilityModifiedToPrivate(func))
- || (func->isModifiedRemoved() && !func->isAbstract()))
+ const bool notAbstract = !func->isAbstract();
+ if ((func->isPrivate() && notAbstract && !visibilityModifiedToPrivate(func))
+ || (func->isModifiedRemoved() && notAbstract))
continue;
if (func->functionType() == AbstractMetaFunction::ConstructorFunction && !func->isUserAdded()) {
writeConstructorNative(s, func);
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index f6bd2cd7e..a033cb69a 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -242,8 +242,9 @@ void HeaderGenerator::writeFunction(QTextStream& s, const AbstractMetaFunction*
}
// pure virtual functions need a default implementation
- if ((func->isPrivate() && !visibilityModifiedToPrivate(func))
- || (func->isModifiedRemoved() && !func->isAbstract()))
+ const bool notAbstract = !func->isAbstract();
+ if ((func->isPrivate() && notAbstract && !visibilityModifiedToPrivate(func))
+ || (func->isModifiedRemoved() && notAbstract))
return;
if (avoidProtectedHack() && func->ownerClass()->hasPrivateDestructor()
diff --git a/sources/shiboken2/tests/libother/otherderived.cpp b/sources/shiboken2/tests/libother/otherderived.cpp
index 4128d73ff..de16b0ab4 100644
--- a/sources/shiboken2/tests/libother/otherderived.cpp
+++ b/sources/shiboken2/tests/libother/otherderived.cpp
@@ -59,3 +59,6 @@ OtherDerived::unpureVirtual()
{
}
+void OtherDerived::pureVirtualPrivate()
+{
+}
diff --git a/sources/shiboken2/tests/libother/otherderived.h b/sources/shiboken2/tests/libother/otherderived.h
index 88c711e1a..592e9e023 100644
--- a/sources/shiboken2/tests/libother/otherderived.h
+++ b/sources/shiboken2/tests/libother/otherderived.h
@@ -60,6 +60,9 @@ public:
protected:
inline const char* getClassName() { return className(); }
virtual const char* className() override { return "OtherDerived"; }
+
+private:
+ void pureVirtualPrivate() override;
};
#endif // OTHERDERIVED_H
diff --git a/sources/shiboken2/tests/libsample/abstract.h b/sources/shiboken2/tests/libsample/abstract.h
index 77a43f3d1..f31870522 100644
--- a/sources/shiboken2/tests/libsample/abstract.h
+++ b/sources/shiboken2/tests/libsample/abstract.h
@@ -102,6 +102,7 @@ protected:
unsigned int bitField: 1;
private:
+ virtual void pureVirtualPrivate() = 0;
int m_id;
};
#endif // ABSTRACT_H
diff --git a/sources/shiboken2/tests/libsample/derived.cpp b/sources/shiboken2/tests/libsample/derived.cpp
index 00ac8ebe5..9552a2a8c 100644
--- a/sources/shiboken2/tests/libsample/derived.cpp
+++ b/sources/shiboken2/tests/libsample/derived.cpp
@@ -103,6 +103,8 @@ struct SecretClass : public Abstract {
virtual void* pureVirtualReturningVoidPtr() { return 0; }
virtual PrintFormat returnAnEnum() { return Short; }
void hideFunction(HideType*){};
+private:
+ virtual void pureVirtualPrivate() {}
};
Abstract* Derived::triggerImpossibleTypeDiscovery()
@@ -117,3 +119,7 @@ Abstract* Derived::triggerAnotherImpossibleTypeDiscovery()
{
return new AnotherSecretClass;
}
+
+void Derived::pureVirtualPrivate()
+{
+}
diff --git a/sources/shiboken2/tests/libsample/derived.h b/sources/shiboken2/tests/libsample/derived.h
index cc8a64d9f..84c502566 100644
--- a/sources/shiboken2/tests/libsample/derived.h
+++ b/sources/shiboken2/tests/libsample/derived.h
@@ -87,6 +87,9 @@ public:
protected:
const char* getClassName() { return className(); }
virtual const char* className() override { return "Derived"; }
+
+private:
+ void pureVirtualPrivate() override;
};
#endif // DERIVED_H