forked from qt-creator/qt-creator
Handle zero files to process
The analyzer was stuck in the running mode (busy cursor, progress bar) for zero files. Change-Id: I9e520dc65b6d027b82e6e31043c0401ebb9f3673 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
@@ -349,6 +349,11 @@ bool ClangStaticAnalyzerRunControl::startEngine()
|
|||||||
const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses();
|
const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses();
|
||||||
QTC_ASSERT(parallelRuns >= 1, emit finished(); return false);
|
QTC_ASSERT(parallelRuns >= 1, emit finished(); return false);
|
||||||
m_success = true;
|
m_success = true;
|
||||||
|
|
||||||
|
if (m_unitsToProcess.isEmpty()) {
|
||||||
|
finalize();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty())
|
while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty())
|
||||||
analyzeNextFile();
|
analyzeNextFile();
|
||||||
return true;
|
return true;
|
||||||
@@ -376,20 +381,8 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile()
|
|||||||
return; // The previous call already reported that we are finished.
|
return; // The previous call already reported that we are finished.
|
||||||
|
|
||||||
if (m_unitsToProcess.isEmpty()) {
|
if (m_unitsToProcess.isEmpty()) {
|
||||||
if (m_runners.size() == 0) {
|
if (m_runners.isEmpty())
|
||||||
appendMessage(tr("Clang Static Analyzer finished: "
|
finalize();
|
||||||
"Processed %1 files successfully, %2 failed.")
|
|
||||||
.arg(m_filesAnalyzed)
|
|
||||||
.arg(m_filesNotAnalyzed)
|
|
||||||
+ QLatin1Char('\n'),
|
|
||||||
Utils::NormalMessageFormat);
|
|
||||||
if (m_filesAnalyzed == 0 && m_filesNotAnalyzed != 0) {
|
|
||||||
AnalyzerUtils::logToIssuesPane(Task::Error,
|
|
||||||
tr("Clang Static Analyzer: Failed to analyze any files."));
|
|
||||||
}
|
|
||||||
m_progress.reportFinished();
|
|
||||||
emit finished();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,5 +473,23 @@ void ClangStaticAnalyzerRunControl::updateProgressValue()
|
|||||||
m_progress.setProgressValue(m_initialFilesToProcessSize - m_unitsToProcess.size());
|
m_progress.setProgressValue(m_initialFilesToProcessSize - m_unitsToProcess.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangStaticAnalyzerRunControl::finalize()
|
||||||
|
{
|
||||||
|
appendMessage(tr("Clang Static Analyzer finished: "
|
||||||
|
"Processed %1 files successfully, %2 failed.")
|
||||||
|
.arg(m_filesAnalyzed)
|
||||||
|
.arg(m_filesNotAnalyzed)
|
||||||
|
+ QLatin1Char('\n'),
|
||||||
|
Utils::NormalMessageFormat);
|
||||||
|
|
||||||
|
if (m_filesAnalyzed == 0 && m_filesNotAnalyzed != 0) {
|
||||||
|
AnalyzerUtils::logToIssuesPane(Task::Error,
|
||||||
|
tr("Clang Static Analyzer: Failed to analyze any files."));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_progress.reportFinished();
|
||||||
|
emit finished();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ClangStaticAnalyzer
|
} // namespace ClangStaticAnalyzer
|
||||||
|
@@ -69,6 +69,8 @@ private:
|
|||||||
void onProgressCanceled();
|
void onProgressCanceled();
|
||||||
void updateProgressValue();
|
void updateProgressValue();
|
||||||
|
|
||||||
|
void finalize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const CppTools::ProjectInfo m_projectInfo;
|
const CppTools::ProjectInfo m_projectInfo;
|
||||||
const unsigned char m_wordWidth;
|
const unsigned char m_wordWidth;
|
||||||
|
Reference in New Issue
Block a user