From 43706c0b651cf602568fd60e4cc78ce2e88cb42e Mon Sep 17 00:00:00 2001 From: Bernhard Beschow Date: Fri, 1 Jan 2021 19:18:40 +0100 Subject: [PATCH] AutoTest: Turn global variable into attribute Change-Id: Id45bafa61f03e8225d5f4224611e2f6db84a16b1 Reviewed-by: hjk Reviewed-by: Christian Stenger --- src/plugins/autotest/testcodeparser.cpp | 16 ++++++---------- src/plugins/autotest/testcodeparser.h | 4 ++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index 99b370436c0..0c3da8a969e 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -169,10 +169,6 @@ void TestCodeParser::updateTestTree(const QSet &frameworks) scanForTests(QStringList(), sortedFrameworks); } -// used internally to indicate a parse that failed due to having triggered a parse for a file that -// is not (yet) part of the CppModelManager's snapshot -static bool parsingHasFailed; - /****** threaded parsing stuff *******/ void TestCodeParser::onDocumentUpdated(const QString &fileName, bool isQmlFile) @@ -333,7 +329,7 @@ void TestCodeParser::scanForTests(const QStringList &fileList, const QListupdateCheckStateCache(); if (isFullParse) { // remove qml files as they will be found automatically by the referencing cpp file @@ -392,7 +388,7 @@ void TestCodeParser::onTaskStarted(Utils::Id type) m_fullUpdatePostponed = m_parserState == FullParse; m_partialUpdatePostponed = !m_fullUpdatePostponed; qCDebug(LOG) << "Canceling scan for test (CppModelParsing started)"; - parsingHasFailed = true; + m_parsingHasFailed = true; Core::ProgressManager::cancelTasks(Constants::TASK_PARSE); } } @@ -401,7 +397,7 @@ void TestCodeParser::onTaskStarted(Utils::Id type) void TestCodeParser::onAllTasksFinished(Utils::Id type) { // if we cancel parsing ensure that progress animation is canceled as well - if (type == Constants::TASK_PARSE && parsingHasFailed) + if (type == Constants::TASK_PARSE && m_parsingHasFailed) emit parsingFailed(); // only CPP parsing is relevant as we trigger Qml parsing internally anyway @@ -416,7 +412,7 @@ void TestCodeParser::onAllTasksFinished(Utils::Id type) void TestCodeParser::onFinished() { if (m_futureWatcher.isCanceled()) - parsingHasFailed = true; + m_parsingHasFailed = true; switch (m_parserState) { case PartialParse: qCDebug(LOG) << "setting state to Idle (onFinished, PartialParse)"; @@ -427,8 +423,8 @@ void TestCodeParser::onFinished() case FullParse: qCDebug(LOG) << "setting state to Idle (onFinished, FullParse)"; m_parserState = Idle; - m_dirty = parsingHasFailed; - if (m_partialUpdatePostponed || m_fullUpdatePostponed || parsingHasFailed) { + m_dirty = m_parsingHasFailed; + if (m_partialUpdatePostponed || m_fullUpdatePostponed || m_parsingHasFailed) { onPartialParsingFinished(); } else { qCDebug(LOG) << "emitting parsingFinished" diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h index 9cef0fc2bda..83c06b0eeed 100644 --- a/src/plugins/autotest/testcodeparser.h +++ b/src/plugins/autotest/testcodeparser.h @@ -102,6 +102,10 @@ private: void parsePostponedFiles(); void releaseParserInternals(); + // used internally to indicate a parse that failed due to having triggered a parse for a file that + // is not (yet) part of the CppModelManager's snapshot + bool m_parsingHasFailed = false; + bool m_codeModelParsing = false; bool m_fullUpdatePostponed = false; bool m_partialUpdatePostponed = false;