ClangTools: Clean up

Remove pointless classes and members.

Change-Id: I0f65934191c9db8b273aff85b70d45d510413cdb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-01-22 15:31:53 +01:00
parent 9ec8deb55e
commit 171f3aec26
4 changed files with 29 additions and 42 deletions

View File

@@ -442,7 +442,7 @@ QList<Diagnostic> ClangTidyClazyTool::read(const QString &filePath,
const QString &logFilePath,
QString *errorMessage) const
{
return LogFileReader::readSerialized(filePath, logFilePath, errorMessage);
return readSerializedDiagnostics(filePath, logFilePath, errorMessage);
}
} // namespace Internal

View File

@@ -123,7 +123,6 @@ private:
private:
std::map<QVector<ExplainingStep>, QVector<DiagnosticItem *>> stepsToItemsCache;
std::unique_ptr<QFileSystemWatcher> m_filesWatcher;
QVector<QString> m_allowFileWriteOnce;
int m_fixItsToApplyCount = 0;
};

View File

@@ -43,37 +43,6 @@
namespace ClangTools {
namespace Internal {
class ClangSerializedDiagnosticsReader
{
public:
QList<Diagnostic> read(const QString &filePath, const QString &logFilePath);
};
static bool checkFilePath(const QString &filePath, QString *errorMessage)
{
QFileInfo fi(filePath);
if (!fi.exists() || !fi.isReadable()) {
if (errorMessage) {
*errorMessage
= QString(QT_TRANSLATE_NOOP("LogFileReader",
"File \"%1\" does not exist or is not readable."))
.arg(filePath);
}
return false;
}
return true;
}
QList<Diagnostic> LogFileReader::readSerialized(const QString &filePath, const QString &logFilePath,
QString *errorMessage)
{
if (!checkFilePath(logFilePath, errorMessage))
return QList<Diagnostic>();
ClangSerializedDiagnosticsReader reader;
return reader.read(filePath, logFilePath);
}
static QString fromCXString(CXString &&cxString)
{
QString result = QString::fromUtf8(clang_getCString(cxString));
@@ -195,8 +164,8 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic, const QString
return diagnostic;
}
QList<Diagnostic> ClangSerializedDiagnosticsReader::read(const QString &filePath,
const QString &logFilePath)
static QList<Diagnostic> readSerializedDiagnostics_helper(const QString &filePath,
const QString &logFilePath)
{
QList<Diagnostic> list;
CXLoadDiag_Error error;
@@ -228,5 +197,30 @@ QList<Diagnostic> ClangSerializedDiagnosticsReader::read(const QString &filePath
return list;
}
static bool checkFilePath(const QString &filePath, QString *errorMessage)
{
QFileInfo fi(filePath);
if (!fi.exists() || !fi.isReadable()) {
if (errorMessage) {
*errorMessage
= QString(QT_TRANSLATE_NOOP("LogFileReader",
"File \"%1\" does not exist or is not readable."))
.arg(filePath);
}
return false;
}
return true;
}
QList<Diagnostic> readSerializedDiagnostics(const QString &filePath,
const QString &logFilePath,
QString *errorMessage)
{
if (!checkFilePath(logFilePath, errorMessage))
return QList<Diagnostic>();
return readSerializedDiagnostics_helper(filePath, logFilePath);
}
} // namespace Internal
} // namespace ClangTools

View File

@@ -28,21 +28,15 @@
#include "clangtoolsdiagnostic.h"
#include <QList>
#include <QCoreApplication>
namespace Utils { class FileName; }
namespace ClangTools {
namespace Internal {
class LogFileReader
{
Q_DECLARE_TR_FUNCTIONS(ClangTools::Internal::LogFileReader)
public:
static QList<Diagnostic> readSerialized(const QString &filePath,
QList<Diagnostic> readSerializedDiagnostics(const QString &filePath,
const QString &logFilePath,
QString *errorMessage);
};
} // namespace Internal
} // namespace ClangTools