From 8eb4d52342fe3a6ede1c1dce3174d95bfa0cea88 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 7 Oct 2022 14:46:06 +0200 Subject: Port from qAsConst() to std::as_const() We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk --- src/plugins/projectexplorer/gcctoolchain.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/projectexplorer/gcctoolchain.cpp') diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 0b2b37fbcf..e4581419fa 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -627,7 +627,7 @@ HeaderPaths GccToolChain::builtInHeaderPaths(const Utils::Environment &env, headerCache->insert({env, arguments}, paths); qCDebug(gccLog) << "Reporting header paths to code model:"; - for (const HeaderPath &hp : qAsConst(paths)) { + for (const HeaderPath &hp : std::as_const(paths)) { qCDebug(gccLog) << compilerCommand.toUserOutput() << (languageId == Constants::CXX_LANGUAGE_ID ? ": C++ [" : ": C [") << arguments.join(", ") << "]" << hp.path; @@ -1108,7 +1108,7 @@ static FilePaths findCompilerCandidates(const ToolchainDetector &detector, FilePaths searchPaths = detector.searchPaths; if (searchPaths.isEmpty()) searchPaths = device->systemEnvironment().path(); - for (const FilePath &deviceDir : qAsConst(searchPaths)) { + for (const FilePath &deviceDir : std::as_const(searchPaths)) { static const QRegularExpression regexp(binaryRegexp); const auto callBack = [&compilerPaths, compilerName](const FilePath &candidate) { if (candidate.fileName() == compilerName) @@ -1142,7 +1142,7 @@ static FilePaths findCompilerCandidates(const ToolchainDetector &detector, searchPaths << ccachePath; } } - for (const FilePath &dir : qAsConst(searchPaths)) { + for (const FilePath &dir : std::as_const(searchPaths)) { static const QRegularExpression regexp(binaryRegexp); QDir binDir(dir.toString()); const QStringList fileNames = binDir.entryList(nameFilters, @@ -1173,7 +1173,7 @@ Toolchains GccToolChainFactory::autoDetectToolchains( Toolchains existingCandidates = filtered(detector.alreadyKnown, [language](const ToolChain *tc) { return tc->language() == language; }); Toolchains result; - for (const FilePath &compilerPath : qAsConst(compilerPaths)) { + for (const FilePath &compilerPath : std::as_const(compilerPaths)) { bool alreadyExists = false; for (ToolChain * const existingTc : existingCandidates) { // We have a match if the existing toolchain ultimately refers to the same file -- cgit v1.2.1