forked from qt-creator/qt-creator
ClangTools: Remove unused members
Change-Id: I0f54705d93f9c12472afcb9587d55f6b9e3740a2 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -44,10 +44,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString message;
|
QString message;
|
||||||
QString extendedMessage;
|
|
||||||
Debugger::DiagnosticLocation location;
|
Debugger::DiagnosticLocation location;
|
||||||
QVector<Debugger::DiagnosticLocation> ranges;
|
QVector<Debugger::DiagnosticLocation> ranges;
|
||||||
int depth = 0;
|
|
||||||
bool isFixIt = false;
|
bool isFixIt = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,8 +57,6 @@ public:
|
|||||||
QString description;
|
QString description;
|
||||||
QString category;
|
QString category;
|
||||||
QString type;
|
QString type;
|
||||||
QString issueContextKind;
|
|
||||||
QString issueContext;
|
|
||||||
Debugger::DiagnosticLocation location;
|
Debugger::DiagnosticLocation location;
|
||||||
QVector<ExplainingStep> explainingSteps;
|
QVector<ExplainingStep> explainingSteps;
|
||||||
bool hasFixits = false;
|
bool hasFixits = false;
|
||||||
|
@@ -92,8 +92,6 @@ QDebug operator<<(QDebug debug, const Diagnostic &d)
|
|||||||
{
|
{
|
||||||
return debug << "category:" << d.category
|
return debug << "category:" << d.category
|
||||||
<< "type:" << d.type
|
<< "type:" << d.type
|
||||||
<< "context:" << d.issueContext
|
|
||||||
<< "contextKind:" << d.issueContextKind
|
|
||||||
<< "hasFixits:" << d.hasFixits
|
<< "hasFixits:" << d.hasFixits
|
||||||
<< "explainingSteps:" << d.explainingSteps.size()
|
<< "explainingSteps:" << d.explainingSteps.size()
|
||||||
<< "location:" << d.location
|
<< "location:" << d.location
|
||||||
@@ -233,13 +231,6 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic, Fixit
|
|||||||
diagnostic.description.toHtmlEscaped());
|
diagnostic.description.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!diagnostic.issueContext.isEmpty() && !diagnostic.issueContextKind.isEmpty()) {
|
|
||||||
lines << qMakePair(
|
|
||||||
QCoreApplication::translate("ClangTools::Diagnostic", "Context:"),
|
|
||||||
diagnostic.issueContextKind.toHtmlEscaped() + QLatin1Char(' ')
|
|
||||||
+ diagnostic.issueContext.toHtmlEscaped());
|
|
||||||
}
|
|
||||||
|
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangTools::Diagnostic", "Location:"),
|
QCoreApplication::translate("ClangTools::Diagnostic", "Location:"),
|
||||||
createFullLocationString(diagnostic.location));
|
createFullLocationString(diagnostic.location));
|
||||||
@@ -266,9 +257,6 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic, Fixit
|
|||||||
|
|
||||||
static QString createExplainingStepToolTipString(const ExplainingStep &step)
|
static QString createExplainingStepToolTipString(const ExplainingStep &step)
|
||||||
{
|
{
|
||||||
if (step.message == step.extendedMessage)
|
|
||||||
return createFullLocationString(step.location);
|
|
||||||
|
|
||||||
using StringPair = QPair<QString, QString>;
|
using StringPair = QPair<QString, QString>;
|
||||||
QList<StringPair> lines;
|
QList<StringPair> lines;
|
||||||
|
|
||||||
@@ -277,11 +265,6 @@ static QString createExplainingStepToolTipString(const ExplainingStep &step)
|
|||||||
QCoreApplication::translate("ClangTools::ExplainingStep", "Message:"),
|
QCoreApplication::translate("ClangTools::ExplainingStep", "Message:"),
|
||||||
step.message.toHtmlEscaped());
|
step.message.toHtmlEscaped());
|
||||||
}
|
}
|
||||||
if (!step.extendedMessage.isEmpty()) {
|
|
||||||
lines << qMakePair(
|
|
||||||
QCoreApplication::translate("ClangTools::ExplainingStep", "Extended message:"),
|
|
||||||
step.extendedMessage.toHtmlEscaped());
|
|
||||||
}
|
|
||||||
|
|
||||||
lines << qMakePair(
|
lines << qMakePair(
|
||||||
QCoreApplication::translate("ClangTools::ExplainingStep", "Location:"),
|
QCoreApplication::translate("ClangTools::ExplainingStep", "Location:"),
|
||||||
|
@@ -210,8 +210,7 @@ void DiagnosticView::suppressCurrentDiagnostic()
|
|||||||
= filePath.relativeChildPath(project->projectDirectory());
|
= filePath.relativeChildPath(project->projectDirectory());
|
||||||
if (!relativeFilePath.isEmpty())
|
if (!relativeFilePath.isEmpty())
|
||||||
filePath = relativeFilePath;
|
filePath = relativeFilePath;
|
||||||
const SuppressedDiagnostic supDiag(filePath, diag.description, diag.issueContextKind,
|
const SuppressedDiagnostic supDiag(filePath, diag.description, diag.explainingSteps.count());
|
||||||
diag.issueContext, diag.explainingSteps.count());
|
|
||||||
ClangToolsProjectSettingsManager::getSettings(project)->addSuppressedDiagnostic(supDiag);
|
ClangToolsProjectSettingsManager::getSettings(project)->addSuppressedDiagnostic(supDiag);
|
||||||
} else {
|
} else {
|
||||||
filterModel->addSuppressedDiagnostic(SuppressedDiagnostic(diag));
|
filterModel->addSuppressedDiagnostic(SuppressedDiagnostic(diag));
|
||||||
|
@@ -42,8 +42,6 @@ static const char SETTINGS_KEY_SELECTED_FILES[] = "ClangTools.SelectedFiles";
|
|||||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS[] = "ClangTools.SuppressedDiagnostics";
|
static const char SETTINGS_KEY_SUPPRESSED_DIAGS[] = "ClangTools.SuppressedDiagnostics";
|
||||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH[] = "ClangTools.SuppressedDiagnosticFilePath";
|
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH[] = "ClangTools.SuppressedDiagnosticFilePath";
|
||||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_MESSAGE[] = "ClangTools.SuppressedDiagnosticMessage";
|
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_MESSAGE[] = "ClangTools.SuppressedDiagnosticMessage";
|
||||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXTKIND[] = "ClangTools.SuppressedDiagnosticContextKind";
|
|
||||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXT[] = "ClangTools.SuppressedDiagnosticContext";
|
|
||||||
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER[] = "ClangTools.SuppressedDiagnosticUniquifier";
|
static const char SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER[] = "ClangTools.SuppressedDiagnosticUniquifier";
|
||||||
|
|
||||||
ClangToolsProjectSettings::ClangToolsProjectSettings(ProjectExplorer::Project *project)
|
ClangToolsProjectSettings::ClangToolsProjectSettings(ProjectExplorer::Project *project)
|
||||||
@@ -113,11 +111,10 @@ void ClangToolsProjectSettings::load()
|
|||||||
fullPath = m_project->projectDirectory().pathAppended(fp);
|
fullPath = m_project->projectDirectory().pathAppended(fp);
|
||||||
if (!fullPath.exists())
|
if (!fullPath.exists())
|
||||||
continue;
|
continue;
|
||||||
const QString contextKind = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXTKIND).toString();
|
|
||||||
const QString context = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXT).toString();
|
|
||||||
const int uniquifier = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER).toInt();
|
const int uniquifier = diag.value(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER).toInt();
|
||||||
m_suppressedDiagnostics << SuppressedDiagnostic(Utils::FilePath::fromString(fp), message,
|
m_suppressedDiagnostics << SuppressedDiagnostic(Utils::FilePath::fromString(fp),
|
||||||
contextKind, context, uniquifier);
|
message,
|
||||||
|
uniquifier);
|
||||||
}
|
}
|
||||||
emit suppressedDiagnosticsChanged();
|
emit suppressedDiagnosticsChanged();
|
||||||
}
|
}
|
||||||
@@ -139,8 +136,6 @@ void ClangToolsProjectSettings::store()
|
|||||||
QVariantMap diagMap;
|
QVariantMap diagMap;
|
||||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH, diag.filePath.toString());
|
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_FILEPATH, diag.filePath.toString());
|
||||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_MESSAGE, diag.description);
|
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_MESSAGE, diag.description);
|
||||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXTKIND, diag.contextKind);
|
|
||||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXT, diag.context);
|
|
||||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER, diag.uniquifier);
|
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER, diag.uniquifier);
|
||||||
list << diagMap;
|
list << diagMap;
|
||||||
}
|
}
|
||||||
@@ -203,8 +198,6 @@ ClangToolsProjectSettingsManager::SettingsMap ClangToolsProjectSettingsManager::
|
|||||||
SuppressedDiagnostic::SuppressedDiagnostic(const Diagnostic &diag)
|
SuppressedDiagnostic::SuppressedDiagnostic(const Diagnostic &diag)
|
||||||
: filePath(Utils::FilePath::fromString(diag.location.filePath))
|
: filePath(Utils::FilePath::fromString(diag.location.filePath))
|
||||||
, description(diag.description)
|
, description(diag.description)
|
||||||
, contextKind(diag.issueContextKind)
|
|
||||||
, context(diag.issueContext)
|
|
||||||
, uniquifier(diag.explainingSteps.count())
|
, uniquifier(diag.explainingSteps.count())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -39,12 +39,9 @@ class Diagnostic;
|
|||||||
class SuppressedDiagnostic
|
class SuppressedDiagnostic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SuppressedDiagnostic(const Utils::FilePath &filePath, const QString &description,
|
SuppressedDiagnostic(const Utils::FilePath &filePath, const QString &description, int uniquifier)
|
||||||
const QString &contextKind, const QString &context, int uniquifier)
|
|
||||||
: filePath(filePath)
|
: filePath(filePath)
|
||||||
, description(description)
|
, description(description)
|
||||||
, contextKind(contextKind)
|
|
||||||
, context(context)
|
|
||||||
, uniquifier(uniquifier)
|
, uniquifier(uniquifier)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -53,16 +50,14 @@ public:
|
|||||||
|
|
||||||
Utils::FilePath filePath; // Relative for files in project, absolute otherwise.
|
Utils::FilePath filePath; // Relative for files in project, absolute otherwise.
|
||||||
QString description;
|
QString description;
|
||||||
QString contextKind;
|
|
||||||
QString context;
|
|
||||||
int uniquifier;
|
int uniquifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2)
|
inline bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2)
|
||||||
{
|
{
|
||||||
return d1.filePath == d2.filePath && d1.description == d2.description
|
return d1.filePath == d2.filePath
|
||||||
&& d1.contextKind == d2.contextKind && d1.context == d2.context
|
&& d1.description == d2.description
|
||||||
&& d1.uniquifier == d2.uniquifier;
|
&& d1.uniquifier == d2.uniquifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
using SuppressedDiagnosticsList = QList<SuppressedDiagnostic>;
|
using SuppressedDiagnosticsList = QList<SuppressedDiagnostic>;
|
||||||
|
@@ -45,7 +45,7 @@ public:
|
|||||||
SuppressedDiagnostic diagnosticAt(int i) const;
|
SuppressedDiagnostic diagnosticAt(int i) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Columns { ColumnFile, ColumnContext, ColumnDescription, ColumnLast = ColumnDescription };
|
enum Columns { ColumnFile, ColumnDescription, ColumnLast = ColumnDescription };
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex & = QModelIndex()) const override { return ColumnLast + 1; }
|
int columnCount(const QModelIndex & = QModelIndex()) const override { return ColumnLast + 1; }
|
||||||
@@ -137,8 +137,6 @@ QVariant SuppressedDiagnosticsModel::headerData(int section, Qt::Orientation ori
|
|||||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
||||||
if (section == ColumnFile)
|
if (section == ColumnFile)
|
||||||
return tr("File");
|
return tr("File");
|
||||||
if (section == ColumnContext)
|
|
||||||
return tr("Context");
|
|
||||||
if (section == ColumnDescription)
|
if (section == ColumnDescription)
|
||||||
return tr("Diagnostic");
|
return tr("Diagnostic");
|
||||||
}
|
}
|
||||||
@@ -152,11 +150,6 @@ QVariant SuppressedDiagnosticsModel::data(const QModelIndex &index, int role) co
|
|||||||
const SuppressedDiagnostic &diag = m_diagnostics.at(index.row());
|
const SuppressedDiagnostic &diag = m_diagnostics.at(index.row());
|
||||||
if (index.column() == ColumnFile)
|
if (index.column() == ColumnFile)
|
||||||
return diag.filePath.toUserOutput();
|
return diag.filePath.toUserOutput();
|
||||||
if (index.column() == ColumnContext) {
|
|
||||||
if (diag.contextKind == QLatin1String("function") && !diag.context.isEmpty())
|
|
||||||
return tr("Function \"%1\"").arg(diag.context);
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
if (index.column() == ColumnDescription)
|
if (index.column() == ColumnDescription)
|
||||||
return diag.description;
|
return diag.description;
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
Reference in New Issue
Block a user