forked from qt-creator/qt-creator
ClangTools: Sanitize parameter order
The path to the serialized diagnostics log is the main parameter, so put it first. Change-Id: I8865aad302b0e5d3008dab606ab774167cebda3c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -463,14 +463,14 @@ void ClangTidyClazyTool::handleStateUpdate()
|
|||||||
Debugger::showPermanentStatusMessage(message);
|
Debugger::showPermanentStatusMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
Diagnostics ClangTidyClazyTool::read(const QString &filePath,
|
Diagnostics ClangTidyClazyTool::read(const QString &logFilePath,
|
||||||
|
const QString &mainFilePath,
|
||||||
const QSet<Utils::FilePath> &projectFiles,
|
const QSet<Utils::FilePath> &projectFiles,
|
||||||
const QString &logFilePath,
|
|
||||||
QString *errorMessage) const
|
QString *errorMessage) const
|
||||||
{
|
{
|
||||||
return readSerializedDiagnostics(Utils::FilePath::fromString(filePath),
|
return readSerializedDiagnostics(Utils::FilePath::fromString(logFilePath),
|
||||||
|
Utils::FilePath::fromString(mainFilePath),
|
||||||
projectFiles,
|
projectFiles,
|
||||||
Utils::FilePath::fromString(logFilePath),
|
|
||||||
errorMessage);
|
errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,9 +53,9 @@ public:
|
|||||||
|
|
||||||
void startTool(bool askUserForFileSelection) final;
|
void startTool(bool askUserForFileSelection) final;
|
||||||
|
|
||||||
Diagnostics read(const QString &filePath,
|
Diagnostics read(const QString &logFilePath,
|
||||||
|
const QString &mainFilePath,
|
||||||
const QSet<Utils::FilePath> &projectFiles,
|
const QSet<Utils::FilePath> &projectFiles,
|
||||||
const QString &logFilePath,
|
|
||||||
QString *errorMessage) const final;
|
QString *errorMessage) const final;
|
||||||
|
|
||||||
void onNewDiagnosticsAvailable(const Diagnostics &diagnostics) override;
|
void onNewDiagnosticsAvailable(const Diagnostics &diagnostics) override;
|
||||||
|
@@ -50,9 +50,9 @@ public:
|
|||||||
|
|
||||||
virtual void startTool(bool askUserForFileSelection) = 0;
|
virtual void startTool(bool askUserForFileSelection) = 0;
|
||||||
|
|
||||||
virtual Diagnostics read(const QString &filePath,
|
virtual Diagnostics read(const QString &logFilePath,
|
||||||
|
const QString &mainFilePath,
|
||||||
const QSet<Utils::FilePath> &projectFiles,
|
const QSet<Utils::FilePath> &projectFiles,
|
||||||
const QString &logFilePath,
|
|
||||||
QString *errorMessage) const = 0;
|
QString *errorMessage) const = 0;
|
||||||
|
|
||||||
FileInfos collectFileInfos(ProjectExplorer::Project *project,
|
FileInfos collectFileInfos(ProjectExplorer::Project *project,
|
||||||
|
@@ -398,9 +398,9 @@ void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
|
|||||||
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
|
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
|
||||||
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
const Diagnostics diagnostics = tool()->read(filePath,
|
const Diagnostics diagnostics = tool()->read(logFilePath,
|
||||||
|
filePath,
|
||||||
m_projectFiles,
|
m_projectFiles,
|
||||||
logFilePath,
|
|
||||||
&errorMessage);
|
&errorMessage);
|
||||||
QFile::remove(logFilePath); // Clean-up.
|
QFile::remove(logFilePath); // Clean-up.
|
||||||
|
|
||||||
|
@@ -182,9 +182,9 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
|
|||||||
return diagnostic;
|
return diagnostic;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &filePath,
|
static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &logFilePath,
|
||||||
const QSet<Utils::FilePath> &projectFiles,
|
const Utils::FilePath &mainFilePath,
|
||||||
const Utils::FilePath &logFilePath)
|
const QSet<Utils::FilePath> &projectFiles)
|
||||||
{
|
{
|
||||||
Diagnostics list;
|
Diagnostics list;
|
||||||
CXLoadDiag_Error error;
|
CXLoadDiag_Error error;
|
||||||
@@ -200,7 +200,7 @@ static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &fileP
|
|||||||
clang_disposeDiagnosticSet(diagnostics);
|
clang_disposeDiagnosticSet(diagnostics);
|
||||||
});
|
});
|
||||||
|
|
||||||
const QString nativeFilePath = QDir::toNativeSeparators(filePath.toString());
|
const QString nativeFilePath = QDir::toNativeSeparators(mainFilePath.toString());
|
||||||
for (unsigned i = 0; i < clang_getNumDiagnosticsInSet(diagnostics); ++i) {
|
for (unsigned i = 0; i < clang_getNumDiagnosticsInSet(diagnostics); ++i) {
|
||||||
CXDiagnostic cxDiagnostic = clang_getDiagnosticInSet(diagnostics, i);
|
CXDiagnostic cxDiagnostic = clang_getDiagnosticInSet(diagnostics, i);
|
||||||
Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() {
|
Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() {
|
||||||
@@ -231,15 +231,15 @@ static bool checkFilePath(const Utils::FilePath &filePath, QString *errorMessage
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Diagnostics readSerializedDiagnostics(const Utils::FilePath &filePath,
|
Diagnostics readSerializedDiagnostics(const Utils::FilePath &logFilePath,
|
||||||
|
const Utils::FilePath &mainFilePath,
|
||||||
const QSet<Utils::FilePath> &projectFiles,
|
const QSet<Utils::FilePath> &projectFiles,
|
||||||
const Utils::FilePath &logFilePath,
|
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (!checkFilePath(logFilePath, errorMessage))
|
if (!checkFilePath(logFilePath, errorMessage))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return readSerializedDiagnostics_helper(filePath, projectFiles, logFilePath);
|
return readSerializedDiagnostics_helper(logFilePath, mainFilePath, projectFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -34,9 +34,9 @@ namespace Utils { class FilePath; }
|
|||||||
namespace ClangTools {
|
namespace ClangTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
Diagnostics readSerializedDiagnostics(const Utils::FilePath &filePath,
|
Diagnostics readSerializedDiagnostics(const Utils::FilePath &logFilePath,
|
||||||
|
const Utils::FilePath &mainFilePath,
|
||||||
const QSet<Utils::FilePath> &projectFiles,
|
const QSet<Utils::FilePath> &projectFiles,
|
||||||
const Utils::FilePath &logFilePath,
|
|
||||||
QString *errorMessage);
|
QString *errorMessage);
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user