forked from qt-creator/qt-creator
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:
@@ -90,6 +90,7 @@ ClangToolRunner::ClangToolRunner(const AnalyzeInputData &input, QObject *parent)
|
|||||||
<< "--"
|
<< "--"
|
||||||
<< clangArguments(input.config, baseOptions);
|
<< clangArguments(input.config, baseOptions);
|
||||||
};
|
};
|
||||||
|
m_overlayFilePath = input.overlayFilePath;
|
||||||
m_outputDirPath = input.outputDirPath;
|
m_outputDirPath = input.outputDirPath;
|
||||||
QTC_CHECK(!m_outputDirPath.isEmpty());
|
QTC_CHECK(!m_outputDirPath.isEmpty());
|
||||||
|
|
||||||
|
@@ -22,6 +22,7 @@ struct AnalyzeInputData
|
|||||||
CppEditor::ClangDiagnosticConfig config;
|
CppEditor::ClangDiagnosticConfig config;
|
||||||
Utils::FilePath outputDirPath;
|
Utils::FilePath outputDirPath;
|
||||||
Utils::Environment environment;
|
Utils::Environment environment;
|
||||||
|
QString overlayFilePath = {};
|
||||||
};
|
};
|
||||||
class ClangToolRunner : public QObject
|
class ClangToolRunner : public QObject
|
||||||
{
|
{
|
||||||
@@ -30,8 +31,6 @@ class ClangToolRunner : public QObject
|
|||||||
public:
|
public:
|
||||||
ClangToolRunner(const AnalyzeInputData &input, QObject *parent = nullptr);
|
ClangToolRunner(const AnalyzeInputData &input, QObject *parent = nullptr);
|
||||||
|
|
||||||
void setVFSOverlay(const QString overlayFilePath) { m_overlayFilePath = overlayFilePath; }
|
|
||||||
|
|
||||||
QString name() const { return m_name; }
|
QString name() const { return m_name; }
|
||||||
Utils::FilePath executable() const { return m_executable; }
|
Utils::FilePath executable() const { return m_executable; }
|
||||||
QString fileToAnalyze() const { return m_fileToAnalyze; }
|
QString fileToAnalyze() const { return m_fileToAnalyze; }
|
||||||
|
@@ -234,7 +234,6 @@ void DocumentClangToolRunner::runNext()
|
|||||||
} else {
|
} else {
|
||||||
const AnalyzeUnit unit(m_fileInfo, clangIncludeDir, clangVersion);
|
const AnalyzeUnit unit(m_fileInfo, clangIncludeDir, clangVersion);
|
||||||
QTC_ASSERT(FilePath::fromString(unit.file).exists(), runNext(); return;);
|
QTC_ASSERT(FilePath::fromString(unit.file).exists(), runNext(); return;);
|
||||||
m_currentRunner->setVFSOverlay(vfso().overlayFilePath().toString());
|
|
||||||
if (!m_currentRunner->run(unit.file, unit.arguments))
|
if (!m_currentRunner->run(unit.file, unit.arguments))
|
||||||
runNext();
|
runNext();
|
||||||
}
|
}
|
||||||
@@ -368,7 +367,8 @@ ClangToolRunner *DocumentClangToolRunner::createRunner(ClangToolType tool,
|
|||||||
const ClangDiagnosticConfig &config,
|
const ClangDiagnosticConfig &config,
|
||||||
const Environment &env)
|
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,
|
connect(runner, &ClangToolRunner::finishedWithSuccess,
|
||||||
this, &DocumentClangToolRunner::onSuccess);
|
this, &DocumentClangToolRunner::onSuccess);
|
||||||
connect(runner, &ClangToolRunner::finishedWithFailure,
|
connect(runner, &ClangToolRunner::finishedWithFailure,
|
||||||
|
@@ -92,17 +92,17 @@ void VirtualFileSystemOverlay::update()
|
|||||||
overlayFile.close();
|
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);
|
const auto it = m_saved.constFind(doc);
|
||||||
if (it != m_saved.end())
|
if (it != m_saved.constEnd())
|
||||||
return it.value().path;
|
return it.value().path;
|
||||||
return doc->filePath();
|
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);
|
return m_mapping.value(file, file);
|
||||||
}
|
}
|
||||||
|
@@ -21,9 +21,9 @@ public:
|
|||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
Utils::FilePath overlayFilePath();
|
Utils::FilePath overlayFilePath() const;
|
||||||
Utils::FilePath autoSavedFilePath(Core::IDocument *doc);
|
Utils::FilePath autoSavedFilePath(Core::IDocument *doc) const;
|
||||||
Utils::FilePath originalFilePath(const Utils::FilePath &file);
|
Utils::FilePath originalFilePath(const Utils::FilePath &file) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Utils::TemporaryDirectory m_root;
|
Utils::TemporaryDirectory m_root;
|
||||||
|
Reference in New Issue
Block a user