From bc3ebef7ceb261867ca57a3f8cb1abab2a46fa56 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 16 Jan 2023 15:00:15 +0100 Subject: AutoTest: Use using namespace Utils more often Change-Id: I9d20cd3496c4719d58a977f8fd53253c86d55463 Reviewed-by: Christian Stenger Reviewed-by: Qt CI Bot Reviewed-by: --- src/plugins/autotest/testcodeparser.cpp | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/plugins/autotest/testcodeparser.cpp') diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index c5dbcd6d51..edf126f8d4 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -26,6 +26,8 @@ #include #include +using namespace Utils; + namespace Autotest { namespace Internal { @@ -146,12 +148,12 @@ void TestCodeParser::updateTestTree(const QSet &parsers) [](const ITestParser *lhs, const ITestParser *rhs) { return lhs->framework()->priority() < rhs->framework()->priority(); }); - scanForTests(Utils::FilePaths(), sortedParsers); + scanForTests({}, sortedParsers); } /****** threaded parsing stuff *******/ -void TestCodeParser::onDocumentUpdated(const Utils::FilePath &fileName, bool isQmlFile) +void TestCodeParser::onDocumentUpdated(const FilePath &fileName, bool isQmlFile) { if (isProjectParsing() || m_codeModelParsing || m_postponedUpdateType == UpdateType::FullUpdate) return; @@ -163,7 +165,7 @@ void TestCodeParser::onDocumentUpdated(const Utils::FilePath &fileName, bool isQ if (!isQmlFile && !project->isKnownFile(fileName)) return; - scanForTests(Utils::FilePaths{fileName}); + scanForTests({fileName}); } void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document) @@ -174,7 +176,7 @@ void TestCodeParser::onCppDocumentUpdated(const CPlusPlus::Document::Ptr &docume void TestCodeParser::onQmlDocumentUpdated(const QmlJS::Document::Ptr &document) { static const QStringList ignoredSuffixes{ "qbs", "ui.qml" }; - const Utils::FilePath fileName = document->fileName(); + const FilePath fileName = document->fileName(); if (!ignoredSuffixes.contains(fileName.suffix())) onDocumentUpdated(fileName, true); } @@ -211,7 +213,7 @@ void TestCodeParser::aboutToShutdown() } } -bool TestCodeParser::postponed(const Utils::FilePaths &fileList) +bool TestCodeParser::postponed(const FilePaths &fileList) { switch (m_parserState) { case Idle: @@ -253,7 +255,7 @@ bool TestCodeParser::postponed(const Utils::FilePaths &fileList) if (m_postponedUpdateType == UpdateType::FullUpdate) return true; // partial parse triggered, postpone or add current files to already postponed partial - for (const Utils::FilePath &file : fileList) + for (const FilePath &file : fileList) m_postponedFiles.insert(file); m_postponedUpdateType = UpdateType::PartialUpdate; } @@ -266,7 +268,7 @@ bool TestCodeParser::postponed(const Utils::FilePaths &fileList) static void parseFileForTests(const QList &parsers, QFutureInterface &futureInterface, - const Utils::FilePath &fileName) + const FilePath &fileName) { for (ITestParser *parser : parsers) { if (futureInterface.isCanceled()) @@ -276,8 +278,7 @@ static void parseFileForTests(const QList &parsers, } } -void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, - const QList &parsers) +void TestCodeParser::scanForTests(const FilePaths &fileList, const QList &parsers) { if (m_parserState == Shutdown || m_testCodeParsers.isEmpty()) return; @@ -292,7 +293,7 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, Project *project = SessionManager::startupProject(); if (!project) return; - Utils::FilePaths list; + FilePaths list; if (isFullParse) { list = project->files(Project::SourceFiles); if (list.isEmpty()) { @@ -318,7 +319,7 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, TestTreeModel::instance()->updateCheckStateCache(); if (isFullParse) { // remove qml files as they will be found automatically by the referencing cpp file - list = Utils::filtered(list, [](const Utils::FilePath &fn) { + list = Utils::filtered(list, [](const FilePath &fn) { return !fn.endsWith(".qml"); }); if (!parsers.isEmpty()) { @@ -330,11 +331,11 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, } } else if (!parsers.isEmpty()) { for (ITestParser *parser: parsers) { - for (const Utils::FilePath &filePath : std::as_const(list)) + for (const FilePath &filePath : std::as_const(list)) parser->framework()->rootNode()->markForRemovalRecursively(filePath); } } else { - for (const Utils::FilePath &filePath : std::as_const(list)) + for (const FilePath &filePath : std::as_const(list)) emit requestRemoval(filePath); } @@ -353,8 +354,8 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, } // We are only interested in files that have been either parsed by the c++ parser, // or have an extension that one of the parsers is specifically interested in. - const Utils::FilePaths filteredList - = Utils::filtered(list, [&extensions, &cppSnapshot](const Utils::FilePath &fn) { + const FilePaths filteredList + = Utils::filtered(list, [&extensions, &cppSnapshot](const FilePath &fn) { const bool isSupportedExtension = Utils::anyOf(extensions, [&fn](const QString &ext) { return fn.suffix() == ext; }); @@ -366,12 +367,11 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, qCDebug(LOG) << "Starting scan of" << filteredList.size() << "(" << list.size() << ")" << "files with" << codeParsers.size() << "parsers"; - QFuture future = Utils::map( - filteredList, - [codeParsers](QFutureInterface &fi, const Utils::FilePath &file) { + QFuture future = Utils::map(filteredList, + [codeParsers](QFutureInterface &fi, const FilePath &file) { parseFileForTests(codeParsers, fi, file); }, - Utils::MapReduceOption::Unordered, + MapReduceOption::Unordered, m_threadPool, QThread::LowestPriority); m_futureWatcher.setFuture(future); @@ -381,7 +381,7 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList, } } -void TestCodeParser::onTaskStarted(Utils::Id type) +void TestCodeParser::onTaskStarted(Id type) { if (type == CppEditor::Constants::TASK_INDEX) { m_codeModelParsing = true; @@ -395,7 +395,7 @@ void TestCodeParser::onTaskStarted(Utils::Id type) } } -void TestCodeParser::onAllTasksFinished(Utils::Id type) +void TestCodeParser::onAllTasksFinished(Id type) { // if we cancel parsing ensure that progress animation is canceled as well if (type == Constants::TASK_PARSE && m_parsingHasFailed) -- cgit v1.2.1