aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-20 18:17:22 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-21 15:06:22 +0000
commitb7c13a77f48baf5fdfa0371fe49a1a11e35ea8df (patch)
treef6a8e983152c3ea0dc33bbd503f7b13671f7e844
parent91f58dfb2614501bd6634565cff5c3276d10ab37 (diff)
shiboken6: Replace QScopedPointer by std::unique_ptr
qtbase/612a01be6513894ab1ec5a36b699a2142ba7f35c deprecates QScopedPointer::take(), making it useless for the factory pattern. As a drive-by, fix the include order of abstractmetabuilder.cpp. Change-Id: I378f45d1c693fcd0423b4e2c96949d7e3be5d747 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp32
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser.cpp9
2 files changed, 20 insertions, 21 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
index 61899c9ea..a583b6ec2 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
@@ -30,6 +30,7 @@
#include "abstractmetaenum.h"
#include "abstractmetafield.h"
#include "abstractmetafunction.h"
+#include "graph.h"
#include "messages.h"
#include "propertyspec.h"
#include "reporthandler.h"
@@ -37,27 +38,24 @@
#include "typedatabase.h"
#include "typesystem.h"
+#include "parser/codemodel.h"
+
#include <clangparser/clangbuilder.h>
#include <clangparser/clangutils.h>
#include <clangparser/compilersupport.h>
-#include "parser/codemodel.h"
-
-#include <QDebug>
-#include <QDir>
-#include <QFile>
-#include <QFileInfo>
-#include <QRegularExpression>
-#include <QTextStream>
-#include <QVariant>
-#include <QTime>
-#include <QQueue>
-#include <QDir>
+#include <QtCore/QDebug>
+#include <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore/QQueue>
+#include <QtCore/QRegularExpression>
+#include <QtCore/QTemporaryFile>
+#include <QtCore/QTextStream>
#include <cstdio>
#include <algorithm>
-#include "graph.h"
-#include <QTemporaryFile>
+#include <memory>
static inline QString colonColon() { return QStringLiteral("::"); }
@@ -2653,7 +2651,7 @@ void AbstractMetaBuilderPrivate::inheritTemplateFunctions(AbstractMetaClass *sub
continue;
}
- QScopedPointer<AbstractMetaFunction> f(function->copy());
+ std::unique_ptr<AbstractMetaFunction> f(function->copy());
f->setArguments(AbstractMetaArgumentList());
if (!function->isVoid()) {
@@ -2717,13 +2715,13 @@ void AbstractMetaBuilderPrivate::inheritTemplateFunctions(AbstractMetaClass *sub
}
- if (!applyArrayArgumentModifications(f->modifications(subclass), f.data(),
+ if (!applyArrayArgumentModifications(f->modifications(subclass), f.get(),
&errorMessage)) {
qCWarning(lcShiboken, "While specializing %s (%s): %s",
qPrintable(subclass->name()), qPrintable(templateClass->name()),
qPrintable(errorMessage));
}
- subclass->addFunction(f.take());
+ subclass->addFunction(f.release());
}
// Take copy
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
index d71029a03..679541d53 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
@@ -45,6 +45,7 @@
#include <QtCore/QXmlStreamEntityResolver>
#include <algorithm>
+#include <memory>
const char *TARGET_CONVERSION_RULE_FLAG = "0";
const char *NATIVE_CONVERSION_RULE_FLAG = "1";
@@ -1385,9 +1386,9 @@ NamespaceTypeEntry *
{
if (!checkRootElement())
return nullptr;
- QScopedPointer<NamespaceTypeEntry> result(new NamespaceTypeEntry(name, since, currentParentTypeEntry()));
+ std::unique_ptr<NamespaceTypeEntry> result(new NamespaceTypeEntry(name, since, currentParentTypeEntry()));
auto visibility = TypeSystem::Visibility::Unspecified;
- applyCommonAttributes(reader, result.data(), attributes);
+ applyCommonAttributes(reader, result.get(), attributes);
for (int i = attributes->size() - 1; i >= 0; --i) {
const auto attributeName = attributes->at(i).qualifiedName();
if (attributeName == QLatin1String("files")) {
@@ -1428,14 +1429,14 @@ NamespaceTypeEntry *
if (visibility != TypeSystem::Visibility::Unspecified)
result->setVisibility(visibility);
// Handle legacy "generate" before the common handling
- applyComplexTypeAttributes(reader, result.data(), attributes);
+ applyComplexTypeAttributes(reader, result.get(), attributes);
if (result->extends() && !result->hasPattern()) {
m_error = msgExtendingNamespaceRequiresPattern(name);
return nullptr;
}
- return result.take();
+ return result.release();
}
ValueTypeEntry *