aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-29 15:01:46 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-30 11:42:11 +0000
commit08af692e40cb178ad59af2ed7b7b8928c0ac2ff6 (patch)
treee44724cc8288d5f8b7cb51ce0c2cd40684c51e96 /sources/shiboken2/ApiExtractor
parent0689756325d93c7402eac4247638680508c5b914 (diff)
shiboken: Remove data fields representing unimplemented attributes
Remove member variables and enumeration values. Task-number: PYSIDE-743 Change-Id: Id7bff33b180e99e19d02bd895e45e4f0749dc042 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/shiboken2/ApiExtractor')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp22
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h8
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp48
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h94
5 files changed, 4 insertions, 174 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index e9069277a..4c1b257d6 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -724,17 +724,6 @@ bool AbstractMetaFunction::argumentRemoved(int key) const
return false;
}
-bool AbstractMetaFunction::isVirtualSlot() const
-{
- const FunctionModificationList &modifications = this->modifications(declaringClass());
- for (const FunctionModification &modification : modifications) {
- if (modification.isVirtualSlot())
- return true;
- }
-
- return false;
-}
-
bool AbstractMetaFunction::isDeprecated() const
{
const FunctionModificationList &modifications = this->modifications(declaringClass());
@@ -1204,7 +1193,6 @@ AbstractMetaClass::AbstractMetaClass()
: m_hasVirtuals(false),
m_isPolymorphic(false),
m_hasNonpublic(false),
- m_hasVirtualSlots(false),
m_hasNonPrivateConstructor(false),
m_hasPrivateConstructor(false),
m_functionsFixed(false),
@@ -1428,11 +1416,8 @@ void AbstractMetaClass::setFunctions(const AbstractMetaFunctionList &functions)
for (AbstractMetaFunction *f : qAsConst(m_functions)) {
f->setOwnerClass(this);
-
- m_hasVirtualSlots = m_hasVirtualSlots || f->isVirtualSlot();
- m_hasVirtuals = m_hasVirtuals || f->isVirtualSlot() || hasVirtualDestructor();
- m_isPolymorphic = m_isPolymorphic || m_hasVirtuals;
- m_hasNonpublic = m_hasNonpublic || !f->isPublic();
+ if (!f->isPublic())
+ m_hasNonpublic = true;
}
}
@@ -1466,8 +1451,7 @@ void AbstractMetaClass::addFunction(AbstractMetaFunction *function)
else
Q_ASSERT(false); //memory leak
- m_hasVirtualSlots |= function->isVirtualSlot();
- m_hasVirtuals |= function->isVirtual() || function->isVirtualSlot() || hasVirtualDestructor();
+ m_hasVirtuals |= function->isVirtual() || hasVirtualDestructor();
m_isPolymorphic |= m_hasVirtuals;
m_hasNonpublic |= !function->isPublic();
}
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index 54a3549d0..f583d2c98 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -1025,8 +1025,6 @@ public:
// Returns the ownership rules for the given argument in the given context
TypeSystem::Ownership ownership(const AbstractMetaClass *cls, TypeSystem::Language language, int idx) const;
- bool isVirtualSlot() const;
-
QString typeReplaced(int argument_index) const;
bool isRemovedFromAllLanguages(const AbstractMetaClass *) const;
bool isRemovedFrom(const AbstractMetaClass *, TypeSystem::Language language) const;
@@ -1512,11 +1510,6 @@ public:
m_forceShellClass = on;
}
- bool hasVirtualSlots() const
- {
- return m_hasVirtualSlots;
- }
-
/**
* Says if the class that declares or inherits a virtual function.
* \return true if the class implements or inherits any virtual methods
@@ -1700,7 +1693,6 @@ private:
uint m_hasVirtuals : 1;
uint m_isPolymorphic : 1;
uint m_hasNonpublic : 1;
- uint m_hasVirtualSlots : 1;
uint m_hasNonPrivateConstructor : 1;
uint m_hasPrivateConstructor : 1;
uint m_functionsFixed : 1;
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index c418cfe3f..77b1ed23d 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -704,7 +704,6 @@ void TypeEntry::formatDebug(QDebug &d) const
d << ", type=" << m_type << ", codeGeneration=0x"
<< hex << m_codeGeneration << dec;
FORMAT_NONEMPTY_STRING("package", m_targetLangPackage)
- FORMAT_BOOL("preferredConversion", m_preferredConversion)
FORMAT_BOOL("stream", m_stream)
FORMAT_LIST_SIZE("codeSnips", m_codeSnips)
FORMAT_NONEMPTY_STRING("conversionRule", m_conversionRule)
@@ -738,7 +737,6 @@ void ComplexTypeEntry::formatDebug(QDebug &d) const
d << ", copyableFlag=" << m_copyableFlag;
FORMAT_NONEMPTY_STRING("defaultSuperclass", m_defaultSuperclass)
FORMAT_NONEMPTY_STRING("polymorphicIdValue", m_polymorphicIdValue)
- FORMAT_NONEMPTY_STRING("held", m_heldTypeValue)
FORMAT_NONEMPTY_STRING("lookupName", m_lookupName)
FORMAT_NONEMPTY_STRING("targetType", m_targetType)
FORMAT_NONEMPTY_STRING("hash", m_hashFunction)
@@ -753,10 +751,6 @@ void EnumTypeEntry::formatDebug(QDebug &d) const
FORMAT_NONEMPTY_STRING("package", m_packageName)
FORMAT_NONEMPTY_STRING("qualifier", m_qualifier)
FORMAT_NONEMPTY_STRING("targetLangName", m_targetLangName)
- FORMAT_NONEMPTY_STRING("lowerBound", m_lowerBound)
- FORMAT_NONEMPTY_STRING("lupperBound", m_upperBound)
- FORMAT_BOOL("extensible", m_extensible)
- FORMAT_BOOL("forceInteger", m_forceInteger)
if (m_flags)
d << ", flags=(" << m_flags << ')';
}
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 14b47ae8e..e17286900 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -1047,9 +1047,6 @@ PrimitiveTypeEntry *
} else if (name == preferredConversionAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- const bool v = convertBoolean(attributes->takeAt(i).value(),
- preferredConversionAttribute(), true);
- type->setPreferredConversion(v);
} else if (name == preferredTargetLangTypeAttribute()) {
const bool v = convertBoolean(attributes->takeAt(i).value(),
preferredTargetLangTypeAttribute(), true);
@@ -1110,23 +1107,15 @@ EnumTypeEntry *
if (name == QLatin1String("upper-bound")) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- entry->setUpperBound(attributes->takeAt(i).value().toString());
} else if (name == QLatin1String("lower-bound")) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- entry->setLowerBound(attributes->takeAt(i).value().toString());
} else if (name == forceIntegerAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- const bool v = convertBoolean(attributes->takeAt(i).value(),
- forceIntegerAttribute(), false);
- entry->setForceInteger(v);
} else if (name == extensibleAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- const bool v = convertBoolean(attributes->takeAt(i).value(),
- extensibleAttribute(), false);
- entry->setExtensible(v);
} else if (name == flagsAttribute()) {
flagNames = attributes->takeAt(i).value().toString();
}
@@ -1254,22 +1243,17 @@ void Handler::applyComplexTypeAttributes(const QXmlStreamReader &reader,
} else if (name == QLatin1String("held-type")) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- ctype->setHeldType(attributes->takeAt(i).value().toString());
} else if (name == QLatin1String("hash-function")) {
ctype->setHashFunction(attributes->takeAt(i).value().toString());
} else if (name == forceAbstractAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- if (convertBoolean(attributes->takeAt(i).value(), forceAbstractAttribute(), false))
- ctype->setTypeFlags(ctype->typeFlags() | ComplexTypeEntry::ForceAbstract);
} else if (name == deprecatedAttribute()) {
if (convertBoolean(attributes->takeAt(i).value(), deprecatedAttribute(), false))
ctype->setTypeFlags(ctype->typeFlags() | ComplexTypeEntry::Deprecated);
} else if (name == deleteInMainThreadAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- if (convertBoolean(attributes->takeAt(i).value(), deleteInMainThreadAttribute(), false))
- ctype->setTypeFlags(ctype->typeFlags() | ComplexTypeEntry::DeleteInMainThread);
} else if (name == QLatin1String("target-type")) {
ctype->setTargetType(attributes->takeAt(i).value().toString());
}
@@ -1665,12 +1649,6 @@ bool Handler::parseNoNullPointer(const QXmlStreamReader &reader,
const QXmlStreamAttribute attribute = attributes->takeAt(defaultValueIndex);
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, attribute)));
- if (lastArgMod.index == 0) {
- lastArgMod.nullPointerDefaultValue = attribute.value().toString();
- } else {
- qCWarning(lcShiboken)
- << "default values for null pointer guards are only effective for return values";
- }
}
return true;
}
@@ -1939,7 +1917,6 @@ bool Handler::parseModifyFunction(const QXmlStreamReader &reader,
bool deprecated = false;
bool isThread = false;
TypeSystem::AllowThread allowThread = TypeSystem::AllowThread::Unspecified;
- bool virtualSlot = false;
for (int i = attributes->size() - 1; i >= 0; --i) {
const QStringRef name = attributes->at(i).qualifiedName();
if (name == QLatin1String("signature")) {
@@ -1970,8 +1947,6 @@ bool Handler::parseModifyFunction(const QXmlStreamReader &reader,
} else if (name == virtualSlotAttribute()) {
qCWarning(lcShiboken, "%s",
qPrintable(msgUnimplementedAttributeWarning(reader, name)));
- virtualSlot = convertBoolean(attributes->takeAt(i).value(),
- virtualSlotAttribute(), false);
}
}
@@ -2024,8 +1999,6 @@ bool Handler::parseModifyFunction(const QXmlStreamReader &reader,
mod.setIsThread(isThread);
if (allowThread != TypeSystem::AllowThread::Unspecified)
mod.setAllowThread(allowThread);
- if (virtualSlot)
- mod.modifiers |= Modification::VirtualSlot;
m_contextStack.top()->functionMods << mod;
return true;
@@ -2724,7 +2697,6 @@ bool Handler::startElement(const QXmlStreamReader &reader)
PrimitiveTypeEntry::PrimitiveTypeEntry(const QString &name, const QVersionNumber &vr) :
TypeEntry(name, PrimitiveType, vr),
- m_preferredConversion(true),
m_preferredTargetLangType(true)
{
}
@@ -2748,16 +2720,6 @@ PrimitiveTypeEntry *PrimitiveTypeEntry::basicReferencedTypeEntry() const
return baseReferencedTypeEntry ? baseReferencedTypeEntry : m_referencedTypeEntry;
}
-bool PrimitiveTypeEntry::preferredConversion() const
-{
- return m_preferredConversion;
-}
-
-void PrimitiveTypeEntry::setPreferredConversion(bool b)
-{
- m_preferredConversion = b;
-}
-
CodeSnipList TypeEntry::codeSnips() const
{
return m_codeSnips;
@@ -2869,21 +2831,11 @@ QString EnumTypeEntry::targetLangApiName() const
return QLatin1String("jint");
}
-bool EnumTypeEntry::preferredConversion() const
-{
- return false;
-}
-
QString FlagsTypeEntry::targetLangApiName() const
{
return QLatin1String("jint");
}
-bool FlagsTypeEntry::preferredConversion() const
-{
- return false;
-}
-
QString FlagsTypeEntry::qualifiedTargetLangName() const
{
return targetLangPackage() + QLatin1Char('.') + m_enum->targetLangQualifier()
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index df40508a2..f7571b934 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -203,12 +203,6 @@ struct ArgumentModification
QString replace_value;
- // The code to be used to construct a return value when noNullPointers is true and
- // the returned value is null. If noNullPointers is true and this string is
- // empty, then the base class implementation will be used (or a default construction
- // if there is no implementation)
- QString nullPointerDefaultValue;
-
// The text of the new default expression of the argument
QString replacedDefaultExpression;
@@ -254,8 +248,7 @@ struct Modification
CodeInjection = 0x1000,
Rename = 0x2000,
Deprecated = 0x4000,
- ReplaceExpression = 0x8000,
- VirtualSlot = 0x10000 | NonFinal
+ ReplaceExpression = 0x8000
};
bool isAccessModifier() const
@@ -290,10 +283,6 @@ struct Modification
{
return modifiers & NonFinal;
}
- bool isVirtualSlot() const
- {
- return (modifiers & VirtualSlot) == VirtualSlot;
- }
QString accessModifierString() const;
bool isDeprecated() const
@@ -669,15 +658,6 @@ public:
return m_type == EnumValue;
}
- virtual bool preferredConversion() const
- {
- return m_preferredConversion;
- }
- virtual void setPreferredConversion(bool b)
- {
- m_preferredConversion = b;
- }
-
bool stream() const
{
return m_stream;
@@ -902,7 +882,6 @@ private:
uint m_codeGeneration = GenerateAll;
CustomFunction m_customConstructor;
CustomFunction m_customDestructor;
- bool m_preferredConversion = true;
CodeSnipList m_codeSnips;
DocModificationList m_docModifications;
IncludeList m_extraIncludes;
@@ -1029,9 +1008,6 @@ public:
*/
PrimitiveTypeEntry* basicReferencedTypeEntry() const;
- bool preferredConversion() const override;
- void setPreferredConversion(bool b) override;
-
bool preferredTargetLangType() const
{
return m_preferredTargetLangType;
@@ -1045,7 +1021,6 @@ private:
QString m_targetLangName;
QString m_targetLangApiName;
QString m_defaultConstructor;
- uint m_preferredConversion : 1;
uint m_preferredTargetLangType : 1;
PrimitiveTypeEntry* m_referencedTypeEntry = nullptr;
};
@@ -1071,31 +1046,6 @@ public:
m_qualifier = q;
}
- bool preferredConversion() const override;
-
- bool isBoundsChecked() const
- {
- return m_lowerBound.isEmpty() && m_upperBound.isEmpty();
- }
-
- QString upperBound() const
- {
- return m_upperBound;
- }
- void setUpperBound(const QString &bound)
- {
- m_upperBound = bound;
- }
-
- QString lowerBound() const
- {
- return m_lowerBound;
- }
- void setLowerBound(const QString &bound)
- {
- m_lowerBound = bound;
- }
-
void setFlags(FlagsTypeEntry *flags)
{
m_flags = flags;
@@ -1105,15 +1055,6 @@ public:
return m_flags;
}
- bool isExtensible() const
- {
- return m_extensible;
- }
- void setExtensible(bool is)
- {
- m_extensible = is;
- }
-
bool isEnumValueRejected(const QString &name) const
{
return m_rejectedEnums.contains(name);
@@ -1127,15 +1068,6 @@ public:
return m_rejectedEnums;
}
- bool forceInteger() const
- {
- return m_forceInteger;
- }
- void setForceInteger(bool force)
- {
- m_forceInteger = force;
- }
-
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &d) const override;
#endif
@@ -1144,15 +1076,9 @@ private:
QString m_qualifier;
QString m_targetLangName;
- QString m_lowerBound;
- QString m_upperBound;
-
QStringList m_rejectedEnums;
FlagsTypeEntry *m_flags = nullptr;
-
- bool m_extensible = false;
- bool m_forceInteger = false;
};
// EnumValueTypeEntry is used for resolving integer type templates
@@ -1177,7 +1103,6 @@ public:
QString qualifiedTargetLangName() const override;
QString targetLangName() const override;
QString targetLangApiName() const override;
- bool preferredConversion() const override;
QString originalName() const
{
@@ -1197,11 +1122,6 @@ public:
m_targetLangName = name;
}
- bool forceInteger() const
- {
- return m_enum->forceInteger();
- }
-
EnumTypeEntry *originator() const
{
return m_enum;
@@ -1222,8 +1142,6 @@ class ComplexTypeEntry : public TypeEntry
{
public:
enum TypeFlag {
- ForceAbstract = 0x1,
- DeleteInMainThread = 0x2,
Deprecated = 0x4
};
typedef QFlags<TypeFlag> TypeFlags;
@@ -1336,15 +1254,6 @@ public:
return m_polymorphicIdValue;
}
- void setHeldType(const QString &value)
- {
- m_heldTypeValue = value;
- }
- QString heldTypeValue() const
- {
- return m_heldTypeValue;
- }
-
QString targetType() const
{
return m_targetType;
@@ -1418,7 +1327,6 @@ private:
uint m_genericClass : 1;
QString m_polymorphicIdValue;
- QString m_heldTypeValue;
QString m_lookupName;
QString m_targetType;
TypeFlags m_typeFlags;