ClangTools: Fix soft assert when no clang tool can be detected

When no clang include dir or version can be detected the runner
does not contain a valid executable so skip that runner.

Change-Id: Ia1b664b65ac4a9d80042d77dfb5b8842ec06dcea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-08-28 10:31:38 +02:00
parent d6ce25903d
commit 472cae1823

View File

@@ -218,11 +218,15 @@ void DocumentClangToolRunner::runNext()
auto [clangIncludeDir, clangVersion] = getClangIncludeDirAndVersion(m_currentRunner.get());
qCDebug(LOG) << Q_FUNC_INFO << m_currentRunner->executable() << clangIncludeDir
<< clangVersion << m_fileInfo.file;
AnalyzeUnit unit(m_fileInfo, clangIncludeDir, clangVersion);
QTC_ASSERT(Utils::FilePath::fromString(unit.file).exists(), runNext(); return;);
m_currentRunner->setVFSOverlay(vfso().overlayFilePath().toString());
if (!m_currentRunner->run(unit.file, unit.arguments))
if (clangIncludeDir.isEmpty() || clangVersion.isEmpty()) {
runNext();
} else {
AnalyzeUnit unit(m_fileInfo, clangIncludeDir, clangVersion);
QTC_ASSERT(Utils::FilePath::fromString(unit.file).exists(), runNext(); return;);
m_currentRunner->setVFSOverlay(vfso().overlayFilePath().toString());
if (!m_currentRunner->run(unit.file, unit.arguments))
runNext();
}
} else {
finalize();
}