aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-04 16:21:21 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-04 18:13:47 +0100
commit3bb3dad8cf77ad720c3b83c5dd50799c43dc27e7 (patch)
tree3bea01c67681e8895d6297d986a1fd0837dca249
parentd684ff99363fe89f6e73b1788a25fccb33aba2b5 (diff)
shiboken6: Remove unused options of ShibokenGenerator::functionSignature()
Change-Id: If8134a9fd0d1b9f865a62a9a7b85109aebb18b7a Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken6/generator/generator.cpp15
-rw-r--r--sources/shiboken6/generator/generator.h7
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp29
3 files changed, 11 insertions, 40 deletions
diff --git a/sources/shiboken6/generator/generator.cpp b/sources/shiboken6/generator/generator.cpp
index c5c9765ba..43cfb6983 100644
--- a/sources/shiboken6/generator/generator.cpp
+++ b/sources/shiboken6/generator/generator.cpp
@@ -771,7 +771,6 @@ QString Generator::translateType(AbstractMetaType cType,
Options options) const
{
QString s;
- static int constLen = strlen("const");
if (context &&
context->typeEntry()->isGenericClass() &&
@@ -784,19 +783,7 @@ QString Generator::translateType(AbstractMetaType cType,
} else if (cType.isArray()) {
s = translateType(*cType.arrayElementType(), context, options) + QLatin1String("[]");
} else {
- if (options & Generator::OriginalName) {
- s = cType.originalTypeDescription().trimmed();
- if ((options & Generator::ExcludeReference) && s.endsWith(QLatin1Char('&')))
- s.chop(1);
-
- // remove only the last const (avoid remove template const)
- if (options & Generator::ExcludeConst) {
- int index = s.lastIndexOf(QLatin1String("const"));
-
- if (index >= (s.size() - (constLen + 1))) // (VarType const) or (VarType const[*|&])
- s = s.remove(index, constLen);
- }
- } else if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) {
+ if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) {
AbstractMetaType copyType = cType;
if (options & Generator::ExcludeConst)
diff --git a/sources/shiboken6/generator/generator.h b/sources/shiboken6/generator/generator.h
index e15e43b34..1ac5ee2ed 100644
--- a/sources/shiboken6/generator/generator.h
+++ b/sources/shiboken6/generator/generator.h
@@ -191,19 +191,12 @@ public:
ExcludeConst = 0x00000001,
ExcludeReference = 0x00000002,
- SkipName = 0x00000008,
SkipReturnType = 0x00000010,
- OriginalName = 0x00000020,
VirtualCall = 0x00000040,
OriginalTypeDescription = 0x00000080,
SkipRemovedArguments = 0x00000100,
SkipDefaultValues = 0x00000200,
-
- WriteSelf = 0x00000400,
- ExcludeMethodConst = 0x00000800,
-
- ForceValueType = ExcludeReference | ExcludeConst
};
Q_DECLARE_FLAGS(Options, Option)
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index bc03ccbb2..bf06f1f44 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -1257,14 +1257,12 @@ QString ShibokenGenerator::argumentString(const AbstractMetaFunctionCPtr &func,
else
arg = modified_type.replace(QLatin1Char('$'), QLatin1Char('.'));
- if (!(options & Generator::SkipName)) {
- // "int a", "int a[]"
- const int arrayPos = arg.indexOf(QLatin1Char('['));
- if (arrayPos != -1)
- arg.insert(arrayPos, QLatin1Char(' ') + argument.name());
- else
- arg.append(QLatin1Char(' ') + argument.name());
- }
+ // "int a", "int a[]"
+ const int arrayPos = arg.indexOf(QLatin1Char('['));
+ if (arrayPos != -1)
+ arg.insert(arrayPos, QLatin1Char(' ') + argument.name());
+ else
+ arg.append(QLatin1Char(' ') + argument.name());
if ((options & Generator::SkipDefaultValues) != Generator::SkipDefaultValues &&
!argument.originalDefaultValueExpression().isEmpty())
@@ -1297,18 +1295,12 @@ void ShibokenGenerator::writeFunctionArguments(TextStream &s,
{
AbstractMetaArgumentList arguments = func->arguments();
- if (options & Generator::WriteSelf) {
- s << func->implementingClass()->name() << '&';
- if (!(options & SkipName))
- s << " self";
- }
-
int argUsed = 0;
for (int i = 0; i < arguments.size(); ++i) {
if ((options & Generator::SkipRemovedArguments) && func->argumentRemoved(i+1))
continue;
- if ((options & Generator::WriteSelf) || argUsed != 0)
+ if (argUsed != 0)
s << ", ";
writeArgument(s, func, arguments[i], options);
argUsed++;
@@ -1355,7 +1347,7 @@ QString ShibokenGenerator::functionSignature(const AbstractMetaFunctionCPtr &fun
writeFunctionArguments(s, func, options);
s << ')';
- if (func->isConstant() && !(options & Generator::ExcludeMethodConst))
+ if (func->isConstant())
s << " const";
if (func->exceptionSpecification() == ExceptionSpecification::NoExcept)
@@ -1392,9 +1384,8 @@ void ShibokenGenerator::writeFunctionCall(TextStream &s,
const AbstractMetaFunctionCPtr &func,
Options options)
{
- if (!(options & Generator::SkipName))
- s << (func->isConstructor() ? func->ownerClass()->qualifiedCppName() : func->originalName());
- s << '(';
+ s << (func->isConstructor() ? func->ownerClass()->qualifiedCppName() : func->originalName())
+ << '(';
writeArgumentNames(s, func, options);
s << ')';
}