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);
|
||||
}
|
||||
|
||||
Diagnostics ClangTidyClazyTool::read(const QString &filePath,
|
||||
Diagnostics ClangTidyClazyTool::read(const QString &logFilePath,
|
||||
const QString &mainFilePath,
|
||||
const QSet<Utils::FilePath> &projectFiles,
|
||||
const QString &logFilePath,
|
||||
QString *errorMessage) const
|
||||
{
|
||||
return readSerializedDiagnostics(Utils::FilePath::fromString(filePath),
|
||||
return readSerializedDiagnostics(Utils::FilePath::fromString(logFilePath),
|
||||
Utils::FilePath::fromString(mainFilePath),
|
||||
projectFiles,
|
||||
Utils::FilePath::fromString(logFilePath),
|
||||
errorMessage);
|
||||
}
|
||||
|
||||
|
@@ -53,9 +53,9 @@ public:
|
||||
|
||||
void startTool(bool askUserForFileSelection) final;
|
||||
|
||||
Diagnostics read(const QString &filePath,
|
||||
Diagnostics read(const QString &logFilePath,
|
||||
const QString &mainFilePath,
|
||||
const QSet<Utils::FilePath> &projectFiles,
|
||||
const QString &logFilePath,
|
||||
QString *errorMessage) const final;
|
||||
|
||||
void onNewDiagnosticsAvailable(const Diagnostics &diagnostics) override;
|
||||
|
@@ -50,9 +50,9 @@ public:
|
||||
|
||||
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 QString &logFilePath,
|
||||
QString *errorMessage) const = 0;
|
||||
|
||||
FileInfos collectFileInfos(ProjectExplorer::Project *project,
|
||||
|
@@ -398,9 +398,9 @@ void ClangToolRunControl::onRunnerFinishedWithSuccess(const QString &filePath)
|
||||
qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath;
|
||||
|
||||
QString errorMessage;
|
||||
const Diagnostics diagnostics = tool()->read(filePath,
|
||||
const Diagnostics diagnostics = tool()->read(logFilePath,
|
||||
filePath,
|
||||
m_projectFiles,
|
||||
logFilePath,
|
||||
&errorMessage);
|
||||
QFile::remove(logFilePath); // Clean-up.
|
||||
|
||||
|
@@ -182,9 +182,9 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
|
||||
return diagnostic;
|
||||
}
|
||||
|
||||
static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &filePath,
|
||||
const QSet<Utils::FilePath> &projectFiles,
|
||||
const Utils::FilePath &logFilePath)
|
||||
static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &logFilePath,
|
||||
const Utils::FilePath &mainFilePath,
|
||||
const QSet<Utils::FilePath> &projectFiles)
|
||||
{
|
||||
Diagnostics list;
|
||||
CXLoadDiag_Error error;
|
||||
@@ -200,7 +200,7 @@ static Diagnostics readSerializedDiagnostics_helper(const Utils::FilePath &fileP
|
||||
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) {
|
||||
CXDiagnostic cxDiagnostic = clang_getDiagnosticInSet(diagnostics, i);
|
||||
Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() {
|
||||
@@ -231,15 +231,15 @@ static bool checkFilePath(const Utils::FilePath &filePath, QString *errorMessage
|
||||
return true;
|
||||
}
|
||||
|
||||
Diagnostics readSerializedDiagnostics(const Utils::FilePath &filePath,
|
||||
Diagnostics readSerializedDiagnostics(const Utils::FilePath &logFilePath,
|
||||
const Utils::FilePath &mainFilePath,
|
||||
const QSet<Utils::FilePath> &projectFiles,
|
||||
const Utils::FilePath &logFilePath,
|
||||
QString *errorMessage)
|
||||
{
|
||||
if (!checkFilePath(logFilePath, errorMessage))
|
||||
return {};
|
||||
|
||||
return readSerializedDiagnostics_helper(filePath, projectFiles, logFilePath);
|
||||
return readSerializedDiagnostics_helper(logFilePath, mainFilePath, projectFiles);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -34,9 +34,9 @@ namespace Utils { class FilePath; }
|
||||
namespace ClangTools {
|
||||
namespace Internal {
|
||||
|
||||
Diagnostics readSerializedDiagnostics(const Utils::FilePath &filePath,
|
||||
Diagnostics readSerializedDiagnostics(const Utils::FilePath &logFilePath,
|
||||
const Utils::FilePath &mainFilePath,
|
||||
const QSet<Utils::FilePath> &projectFiles,
|
||||
const Utils::FilePath &logFilePath,
|
||||
QString *errorMessage);
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user