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 extendedMessage;
|
||||
Debugger::DiagnosticLocation location;
|
||||
QVector<Debugger::DiagnosticLocation> ranges;
|
||||
int depth = 0;
|
||||
bool isFixIt = false;
|
||||
};
|
||||
|
||||
@@ -59,8 +57,6 @@ public:
|
||||
QString description;
|
||||
QString category;
|
||||
QString type;
|
||||
QString issueContextKind;
|
||||
QString issueContext;
|
||||
Debugger::DiagnosticLocation location;
|
||||
QVector<ExplainingStep> explainingSteps;
|
||||
bool hasFixits = false;
|
||||
|
@@ -92,8 +92,6 @@ QDebug operator<<(QDebug debug, const Diagnostic &d)
|
||||
{
|
||||
return debug << "category:" << d.category
|
||||
<< "type:" << d.type
|
||||
<< "context:" << d.issueContext
|
||||
<< "contextKind:" << d.issueContextKind
|
||||
<< "hasFixits:" << d.hasFixits
|
||||
<< "explainingSteps:" << d.explainingSteps.size()
|
||||
<< "location:" << d.location
|
||||
@@ -233,13 +231,6 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic, Fixit
|
||||
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(
|
||||
QCoreApplication::translate("ClangTools::Diagnostic", "Location:"),
|
||||
createFullLocationString(diagnostic.location));
|
||||
@@ -266,9 +257,6 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic, Fixit
|
||||
|
||||
static QString createExplainingStepToolTipString(const ExplainingStep &step)
|
||||
{
|
||||
if (step.message == step.extendedMessage)
|
||||
return createFullLocationString(step.location);
|
||||
|
||||
using StringPair = QPair<QString, QString>;
|
||||
QList<StringPair> lines;
|
||||
|
||||
@@ -277,11 +265,6 @@ static QString createExplainingStepToolTipString(const ExplainingStep &step)
|
||||
QCoreApplication::translate("ClangTools::ExplainingStep", "Message:"),
|
||||
step.message.toHtmlEscaped());
|
||||
}
|
||||
if (!step.extendedMessage.isEmpty()) {
|
||||
lines << qMakePair(
|
||||
QCoreApplication::translate("ClangTools::ExplainingStep", "Extended message:"),
|
||||
step.extendedMessage.toHtmlEscaped());
|
||||
}
|
||||
|
||||
lines << qMakePair(
|
||||
QCoreApplication::translate("ClangTools::ExplainingStep", "Location:"),
|
||||
|
@@ -210,8 +210,7 @@ void DiagnosticView::suppressCurrentDiagnostic()
|
||||
= filePath.relativeChildPath(project->projectDirectory());
|
||||
if (!relativeFilePath.isEmpty())
|
||||
filePath = relativeFilePath;
|
||||
const SuppressedDiagnostic supDiag(filePath, diag.description, diag.issueContextKind,
|
||||
diag.issueContext, diag.explainingSteps.count());
|
||||
const SuppressedDiagnostic supDiag(filePath, diag.description, diag.explainingSteps.count());
|
||||
ClangToolsProjectSettingsManager::getSettings(project)->addSuppressedDiagnostic(supDiag);
|
||||
} else {
|
||||
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_FILEPATH[] = "ClangTools.SuppressedDiagnosticFilePath";
|
||||
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";
|
||||
|
||||
ClangToolsProjectSettings::ClangToolsProjectSettings(ProjectExplorer::Project *project)
|
||||
@@ -113,11 +111,10 @@ void ClangToolsProjectSettings::load()
|
||||
fullPath = m_project->projectDirectory().pathAppended(fp);
|
||||
if (!fullPath.exists())
|
||||
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();
|
||||
m_suppressedDiagnostics << SuppressedDiagnostic(Utils::FilePath::fromString(fp), message,
|
||||
contextKind, context, uniquifier);
|
||||
m_suppressedDiagnostics << SuppressedDiagnostic(Utils::FilePath::fromString(fp),
|
||||
message,
|
||||
uniquifier);
|
||||
}
|
||||
emit suppressedDiagnosticsChanged();
|
||||
}
|
||||
@@ -139,8 +136,6 @@ void ClangToolsProjectSettings::store()
|
||||
QVariantMap diagMap;
|
||||
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_CONTEXTKIND, diag.contextKind);
|
||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_CONTEXT, diag.context);
|
||||
diagMap.insert(SETTINGS_KEY_SUPPRESSED_DIAGS_UNIQIFIER, diag.uniquifier);
|
||||
list << diagMap;
|
||||
}
|
||||
@@ -203,8 +198,6 @@ ClangToolsProjectSettingsManager::SettingsMap ClangToolsProjectSettingsManager::
|
||||
SuppressedDiagnostic::SuppressedDiagnostic(const Diagnostic &diag)
|
||||
: filePath(Utils::FilePath::fromString(diag.location.filePath))
|
||||
, description(diag.description)
|
||||
, contextKind(diag.issueContextKind)
|
||||
, context(diag.issueContext)
|
||||
, uniquifier(diag.explainingSteps.count())
|
||||
{
|
||||
}
|
||||
|
@@ -39,12 +39,9 @@ class Diagnostic;
|
||||
class SuppressedDiagnostic
|
||||
{
|
||||
public:
|
||||
SuppressedDiagnostic(const Utils::FilePath &filePath, const QString &description,
|
||||
const QString &contextKind, const QString &context, int uniquifier)
|
||||
SuppressedDiagnostic(const Utils::FilePath &filePath, const QString &description, int uniquifier)
|
||||
: filePath(filePath)
|
||||
, description(description)
|
||||
, contextKind(contextKind)
|
||||
, context(context)
|
||||
, uniquifier(uniquifier)
|
||||
{
|
||||
}
|
||||
@@ -53,15 +50,13 @@ public:
|
||||
|
||||
Utils::FilePath filePath; // Relative for files in project, absolute otherwise.
|
||||
QString description;
|
||||
QString contextKind;
|
||||
QString context;
|
||||
int uniquifier;
|
||||
};
|
||||
|
||||
inline bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2)
|
||||
{
|
||||
return d1.filePath == d2.filePath && d1.description == d2.description
|
||||
&& d1.contextKind == d2.contextKind && d1.context == d2.context
|
||||
return d1.filePath == d2.filePath
|
||||
&& d1.description == d2.description
|
||||
&& d1.uniquifier == d2.uniquifier;
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ public:
|
||||
SuppressedDiagnostic diagnosticAt(int i) const;
|
||||
|
||||
private:
|
||||
enum Columns { ColumnFile, ColumnContext, ColumnDescription, ColumnLast = ColumnDescription };
|
||||
enum Columns { ColumnFile, ColumnDescription, ColumnLast = ColumnDescription };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
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 (section == ColumnFile)
|
||||
return tr("File");
|
||||
if (section == ColumnContext)
|
||||
return tr("Context");
|
||||
if (section == ColumnDescription)
|
||||
return tr("Diagnostic");
|
||||
}
|
||||
@@ -152,11 +150,6 @@ QVariant SuppressedDiagnosticsModel::data(const QModelIndex &index, int role) co
|
||||
const SuppressedDiagnostic &diag = m_diagnostics.at(index.row());
|
||||
if (index.column() == ColumnFile)
|
||||
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)
|
||||
return diag.description;
|
||||
return QVariant();
|
||||
|
Reference in New Issue
Block a user