diff options
| author | Tim Blechmann <tim@klingt.org> | 2024-04-24 12:55:58 +0800 |
|---|---|---|
| committer | Tim Blechmann <tim@klingt.org> | 2024-04-30 13:37:53 +0000 |
| commit | 88988c900d9bca3967816f8a3d0e30bf4178ed0f (patch) | |
| tree | 9da3911569bb77fccb5f626021c3e7310afb622b /src/qmlcompiler/qqmljsbasicblocks.cpp | |
| parent | 4949768067cfc8a16c0cef958928e94147842bb8 (diff) | |
QmlCompiler: fix unity builds
`deduplicate` was declared in two translation units, which is breaking
unity builds. Moving the definition to QQmlJSUtils fixes the builds and
makes the code more robust towards potential ODR violations in case the
function is ever changed in one TU, but not in the other.
Change-Id: I57627399d50d284ce031af245fd4ad5aa1ab6405
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsbasicblocks.cpp')
| -rw-r--r-- | src/qmlcompiler/qqmljsbasicblocks.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/qmlcompiler/qqmljsbasicblocks.cpp b/src/qmlcompiler/qqmljsbasicblocks.cpp index 671cac0d25..392a8b9ba7 100644 --- a/src/qmlcompiler/qqmljsbasicblocks.cpp +++ b/src/qmlcompiler/qqmljsbasicblocks.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qqmljsbasicblocks_p.h" +#include "qqmljsutils_p.h" #include <QtQml/private/qv4instr_moth_p.h> @@ -101,15 +102,6 @@ void QQmlJSBasicBlocks::dumpDOTGraph() } } -template<typename Container> -void deduplicate(Container &container) -{ - std::sort(container.begin(), container.end()); - auto erase = std::unique(container.begin(), container.end()); - container.erase(erase, container.end()); -} - - QQmlJSCompilePass::BlocksAndAnnotations QQmlJSBasicBlocks::run(const Function *function, QQmlJSAotCompiler::Flags compileFlags, bool &basicBlocksValidationFailed) @@ -156,7 +148,7 @@ QQmlJSBasicBlocks::run(const Function *function, QQmlJSAotCompiler::Flags compil reset(); decode(byteCode.constData(), static_cast<uint>(byteCode.size())); for (auto it = m_basicBlocks.begin(), end = m_basicBlocks.end(); it != end; ++it) - deduplicate(it->second.jumpOrigins); + QQmlJSUtils::deduplicate(it->second.jumpOrigins); } if (compileFlags.testFlag(QQmlJSAotCompiler::ValidateBasicBlocks) || qv4ValidateBasicBlocks()) { |
