aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amir.abdol@qt.io>2023-04-24 10:44:19 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-25 05:39:10 +0000
commit2a31b22143d1199cc1793593dbd9feb6b65fc6c7 (patch)
tree541e49deb85c92fbb86978d1b8fb92bd2c8604e2
parent398926db49e9e287355f613a240b3f87805ab032 (diff)
Refactor the usage of icutils::Node
In Unity Build, on OpenSUSE, for some reason compiler confuses the Node with an `int`. This refactoring resolves the issue by moving the type into the `icutils` namespace. Task-number: QTBUG-109394 Change-Id: Id379b9aff21b29115d4503791debd658f034a0cd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit c8384198243b693bcab3e2e5e9f95c2694c476da) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/qml/inlinecomponentutils_p.h15
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit.cpp2
2 files changed, 12 insertions, 5 deletions
diff --git a/src/qml/inlinecomponentutils_p.h b/src/qml/inlinecomponentutils_p.h
index 50936a19f0..5a4d8272e5 100644
--- a/src/qml/inlinecomponentutils_p.h
+++ b/src/qml/inlinecomponentutils_p.h
@@ -55,10 +55,14 @@ public:
IndexType index() const { return m_data.get<IndexField>(); }
};
+using NodeList = std::vector<Node>;
using AdjacencyList = std::vector<std::vector<Node*>>;
template<typename ObjectContainer, typename InlineComponent>
-void fillAdjacencyListForInlineComponents(ObjectContainer *objectContainer, AdjacencyList &adjacencyList, std::vector<Node> &nodes, const std::vector<InlineComponent> &allICs) {
+void fillAdjacencyListForInlineComponents(ObjectContainer *objectContainer,
+ AdjacencyList &adjacencyList, NodeList &nodes,
+ const std::vector<InlineComponent> &allICs)
+{
using CompiledObject = typename ObjectContainer::CompiledObject;
// add an edge from A to B if A and B are inline components with the same containing type
// and A inherits from B (ignore indirect chains through external types for now)
@@ -102,7 +106,9 @@ void fillAdjacencyListForInlineComponents(ObjectContainer *objectContainer, Adja
}
};
-inline void topoVisit(Node *node, AdjacencyList &adjacencyList, bool &hasCycle, std::vector<Node> &nodesSorted) {
+inline void topoVisit(Node *node, AdjacencyList &adjacencyList, bool &hasCycle,
+ NodeList &nodesSorted)
+{
if (node->hasPermanentMark())
return;
if (node->hasTemporaryMark()) {
@@ -121,8 +127,9 @@ inline void topoVisit(Node *node, AdjacencyList &adjacencyList, bool &hasCycle,
};
// Use DFS based topological sorting (https://en.wikipedia.org/wiki/Topological_sorting)
-inline std::vector<Node> topoSort(std::vector<Node> &nodes, AdjacencyList &adjacencyList, bool &hasCycle) {
- std::vector<Node> nodesSorted;
+inline NodeList topoSort(NodeList &nodes, AdjacencyList &adjacencyList, bool &hasCycle)
+{
+ NodeList nodesSorted;
nodesSorted.reserve(nodes.size());
hasCycle = false;
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp
index 699d3df443..26072b9e20 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit.cpp
+++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp
@@ -392,7 +392,7 @@ void ExecutableCompilationUnit::finalizeCompositeType(QQmlEnginePrivate *qmlEngi
allICs.push_back(*it);
}
}
- std::vector<Node> nodes;
+ NodeList nodes;
nodes.resize(allICs.size());
std::iota(nodes.begin(), nodes.end(), 0);
AdjacencyList adjacencyList;