ClangToolsUtils: Add isVFSOverlaySupported()

Remove ClangToolRunner::supportsVFSOverlay().
Move check for modified document and vfsOverlay into
runner creator method, as it's called in the same cycle just
before the runner is about to be started.

Change-Id: I7a5df71bfa73c350862e4c7f9eae49773b6206b7
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Jarek Kobus
2023-01-11 20:15:33 +01:00
parent 5dec97ea41
commit 64b9728a68
6 changed files with 31 additions and 42 deletions

View File

@@ -103,25 +103,12 @@ QStringList ClangToolRunner::mainToolArguments() const
{
QStringList result;
result << "-export-fixes=" + m_outputFilePath;
if (!m_input.overlayFilePath.isEmpty() && supportsVFSOverlay())
if (!m_input.overlayFilePath.isEmpty() && isVFSOverlaySupported(m_executable))
result << "--vfsoverlay=" + m_input.overlayFilePath;
result << QDir::toNativeSeparators(m_input.unit.file);
return result;
}
bool ClangToolRunner::supportsVFSOverlay() const
{
static QMap<FilePath, bool> vfsCapabilities;
auto it = vfsCapabilities.find(m_executable);
if (it == vfsCapabilities.end()) {
QtcProcess p;
p.setCommand({m_executable, {"--help"}});
p.runBlocking();
it = vfsCapabilities.insert(m_executable, p.allOutput().contains("vfsoverlay"));
}
return it.value();
}
static QString createOutputFilePath(const FilePath &dirPath, const QString &fileToAnalyze)
{
const QString fileName = QFileInfo(fileToAnalyze).fileName();