ClangToolRunner: Make overlayFilePath a member of AnalyzeInputData

Get rid of setVFSOverlay().

Change-Id: I0f406994f78523c40a5d2f2262f25c9b2c5a5442
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Jarek Kobus
2023-01-10 18:23:24 +01:00
parent 511dc801b5
commit 017ceef3b0
5 changed files with 12 additions and 12 deletions

View File

@@ -90,6 +90,7 @@ ClangToolRunner::ClangToolRunner(const AnalyzeInputData &input, QObject *parent)
<< "--"
<< clangArguments(input.config, baseOptions);
};
m_overlayFilePath = input.overlayFilePath;
m_outputDirPath = input.outputDirPath;
QTC_CHECK(!m_outputDirPath.isEmpty());

View File

@@ -22,6 +22,7 @@ struct AnalyzeInputData
CppEditor::ClangDiagnosticConfig config;
Utils::FilePath outputDirPath;
Utils::Environment environment;
QString overlayFilePath = {};
};
class ClangToolRunner : public QObject
{
@@ -30,8 +31,6 @@ class ClangToolRunner : public QObject
public:
ClangToolRunner(const AnalyzeInputData &input, QObject *parent = nullptr);
void setVFSOverlay(const QString overlayFilePath) { m_overlayFilePath = overlayFilePath; }
QString name() const { return m_name; }
Utils::FilePath executable() const { return m_executable; }
QString fileToAnalyze() const { return m_fileToAnalyze; }

View File

@@ -234,7 +234,6 @@ void DocumentClangToolRunner::runNext()
} else {
const AnalyzeUnit unit(m_fileInfo, clangIncludeDir, clangVersion);
QTC_ASSERT(FilePath::fromString(unit.file).exists(), runNext(); return;);
m_currentRunner->setVFSOverlay(vfso().overlayFilePath().toString());
if (!m_currentRunner->run(unit.file, unit.arguments))
runNext();
}
@@ -368,7 +367,8 @@ ClangToolRunner *DocumentClangToolRunner::createRunner(ClangToolType tool,
const ClangDiagnosticConfig &config,
const Environment &env)
{
auto runner = new ClangToolRunner({tool, config, m_temporaryDir.path(), env}, this);
auto runner = new ClangToolRunner({tool, config, m_temporaryDir.path(), env,
vfso().overlayFilePath().toString()}, this);
connect(runner, &ClangToolRunner::finishedWithSuccess,
this, &DocumentClangToolRunner::onSuccess);
connect(runner, &ClangToolRunner::finishedWithFailure,

View File

@@ -92,17 +92,17 @@ void VirtualFileSystemOverlay::update()
overlayFile.close();
}
Utils::FilePath VirtualFileSystemOverlay::overlayFilePath() { return m_overlayFilePath; }
Utils::FilePath VirtualFileSystemOverlay::overlayFilePath() const { return m_overlayFilePath; }
Utils::FilePath VirtualFileSystemOverlay::autoSavedFilePath(Core::IDocument *doc)
Utils::FilePath VirtualFileSystemOverlay::autoSavedFilePath(Core::IDocument *doc) const
{
auto it = m_saved.find(doc);
if (it != m_saved.end())
const auto it = m_saved.constFind(doc);
if (it != m_saved.constEnd())
return it.value().path;
return doc->filePath();
}
Utils::FilePath VirtualFileSystemOverlay::originalFilePath(const Utils::FilePath &file)
Utils::FilePath VirtualFileSystemOverlay::originalFilePath(const Utils::FilePath &file) const
{
return m_mapping.value(file, file);
}

View File

@@ -21,9 +21,9 @@ public:
void update();
Utils::FilePath overlayFilePath();
Utils::FilePath autoSavedFilePath(Core::IDocument *doc);
Utils::FilePath originalFilePath(const Utils::FilePath &file);
Utils::FilePath overlayFilePath() const;
Utils::FilePath autoSavedFilePath(Core::IDocument *doc) const;
Utils::FilePath originalFilePath(const Utils::FilePath &file) const;
private:
Utils::TemporaryDirectory m_root;