Valgrind: Strip QLatin1*

Change-Id: If93ca890ab6d023ab786a5153f50a1dfa03764de
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Orgad Shaneh
2018-12-01 20:56:21 +02:00
committed by Orgad Shaneh
parent 7096649fc2
commit 2c212d48a5
21 changed files with 314 additions and 315 deletions

View File

@@ -46,7 +46,7 @@ using namespace Utils;
namespace Valgrind { namespace Valgrind {
namespace Callgrind { namespace Callgrind {
const QLatin1String CALLGRIND_CONTROL_BINARY("callgrind_control"); const char CALLGRIND_CONTROL_BINARY[] = "callgrind_control";
CallgrindController::CallgrindController() CallgrindController::CallgrindController()
{ {
@@ -229,7 +229,7 @@ void CallgrindController::getLocalDataFile()
const QStringList outputFiles = dir.entryList(); const QStringList outputFiles = dir.entryList();
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those // if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
if (!outputFiles.isEmpty()) if (!outputFiles.isEmpty())
fileName = workingDir + QLatin1Char('/') + outputFiles.first(); fileName = workingDir + '/' + outputFiles.first();
emit localParseDataAvailable(fileName); emit localParseDataAvailable(fileName);
} }

View File

@@ -174,7 +174,7 @@ QModelIndex DataModel::indexForObject(const Function *function) const
static QString noWrap(const QString &str) static QString noWrap(const QString &str)
{ {
QString escapedStr = str; QString escapedStr = str;
return escapedStr.replace(QLatin1Char('-'), QLatin1String("&#8209;")); return escapedStr.replace('-', "&#8209;");
} }
static QString shortenTemplate(QString str) static QString shortenTemplate(QString str)
@@ -219,16 +219,16 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
if (!d->m_verboseToolTips) if (!d->m_verboseToolTips)
return data(index, Qt::DisplayRole); return data(index, Qt::DisplayRole);
QString ret = QLatin1String("<html><head><style>\ QString ret = "<html><head><style>\n"
dt { font-weight: bold; }\ "dt { font-weight: bold; }\n"
dd { font-family: monospace; }\ "dd { font-family: monospace; }\n"
tr.head, td.head { font-weight: bold; }\ "tr.head, td.head { font-weight: bold; }\n"
tr.head { text-decoration: underline; }\ "tr.head { text-decoration: underline; }\n"
td.group { padding-left: 20px; }\ "td.group { padding-left: 20px; }\n"
td { white-space: nowrap; }\ "td { white-space: nowrap; }\n"
</style></head>\n<body><dl>"); "</style></head>\n<body><dl>\n";
QString entry = QLatin1String("<dt>%1</dt><dd>%2</dd>\n"); QString entry = "<dt>%1</dt><dd>%2</dd>\n";
// body, function info first // body, function info first
ret += entry.arg(tr("Function:")).arg(func->name().toHtmlEscaped()); ret += entry.arg(tr("Function:")).arg(func->name().toHtmlEscaped());
ret += entry.arg(tr("File:")).arg(func->file()); ret += entry.arg(tr("File:")).arg(func->file());
@@ -241,17 +241,17 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
} }
ret += entry.arg(tr("Object:")).arg(func->object()); ret += entry.arg(tr("Object:")).arg(func->object());
ret += entry.arg(tr("Called:")).arg(tr("%n time(s)", 0, func->called())); ret += entry.arg(tr("Called:")).arg(tr("%n time(s)", 0, func->called()));
ret += QLatin1String("</dl><p/>"); ret += "</dl><p/>";
// self/inclusive costs // self/inclusive costs
entry = QLatin1String("<td class='group'>%1</td><td>%2</td>"); entry = "<td class='group'>%1</td><td>%2</td>";
ret += QLatin1String("<table>"); ret += "<table>";
ret += QLatin1String("<thead><tr class='head'>"); ret += "<thead><tr class='head'>";
ret += QLatin1String("<td>") + tr("Events") + QLatin1String("</td>"); ret += "<td>" + tr("Events") + "</td>";
ret += entry.arg(tr("Self costs")).arg(tr("(%)")); ret += entry.arg(tr("Self costs")).arg(tr("(%)"));
ret += entry.arg(tr("Incl. costs")).arg(tr("(%)")); ret += entry.arg(tr("Incl. costs")).arg(tr("(%)"));
ret += QLatin1String("</tr></thead>"); ret += "</tr></thead>";
ret += QLatin1String("<tbody>"); ret += "<tbody>";
for (int i = 0; i < d->m_data->events().size(); ++i) { for (int i = 0; i < d->m_data->events().size(); ++i) {
quint64 selfCost = func->selfCost(i); quint64 selfCost = func->selfCost(i);
quint64 inclCost = func->inclusiveCost(i); quint64 inclCost = func->inclusiveCost(i);
@@ -260,16 +260,16 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
const float relSelfCost = (float)qRound((float)selfCost / totalCost * 10000) / 100; const float relSelfCost = (float)qRound((float)selfCost / totalCost * 10000) / 100;
const float relInclCost = (float)qRound((float)inclCost / totalCost * 10000) / 100; const float relInclCost = (float)qRound((float)inclCost / totalCost * 10000) / 100;
ret += QLatin1String("<tr>"); ret += "<tr>";
ret += QLatin1String("<td class='head'><nobr>") + ret += "<td class='head'><nobr>" +
noWrap(ParseData::prettyStringForEvent(d->m_data->events().at(i))) noWrap(ParseData::prettyStringForEvent(d->m_data->events().at(i)))
+ QLatin1String("</nobr></td>"); + "</nobr></td>";
ret += entry.arg(selfCost).arg(tr("(%1%)").arg(relSelfCost)); ret += entry.arg(selfCost).arg(tr("(%1%)").arg(relSelfCost));
ret += entry.arg(inclCost).arg(tr("(%1%)").arg(relInclCost)); ret += entry.arg(inclCost).arg(tr("(%1%)").arg(relInclCost));
ret += QLatin1String("</tr>"); ret += "</tr>";
} }
ret += QLatin1String("</tbody></table>"); ret += "</tbody></table>";
ret += QLatin1String("</body></html>"); ret += "</body></html>";
return ret; return ret;
} }

View File

@@ -200,7 +200,7 @@ QString Function::location() const
QString o = object(); QString o = object();
if (o.isEmpty()) if (o.isEmpty())
return QString(); return QString();
if (f.isEmpty() || f == QLatin1String("???")) if (f.isEmpty() || f == "???")
return o; return o;
if (pos.isEmpty()) if (pos.isEmpty())
return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1 in %2").arg(f, o); return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1 in %2").arg(f, o);

View File

@@ -166,19 +166,19 @@ QString ParseData::prettyStringForEvent(const QString &event)
QTC_ASSERT(event.size() >= 2, return event); // should not happen QTC_ASSERT(event.size() >= 2, return event); // should not happen
const bool isMiss = event.contains(QLatin1Char('m')); // else hit const bool isMiss = event.contains('m'); // else hit
const bool isRead = event.contains(QLatin1Char('r')); // else write const bool isRead = event.contains('r'); // else write
QString type; QString type;
if (event.contains(QLatin1Char('L'))) if (event.contains('L'))
type = ParseData::Private::tr("Last-level"); // first, "L" overwrites the others type = ParseData::Private::tr("Last-level"); // first, "L" overwrites the others
else if (event.at(0) == QLatin1Char('I')) else if (event.at(0) == 'I')
type = ParseData::Private::tr("Instruction"); type = ParseData::Private::tr("Instruction");
else if (event.at(0) == QLatin1Char('D')) else if (event.at(0) == 'D')
type = ParseData::Private::tr("Cache"); type = ParseData::Private::tr("Cache");
else if (event.leftRef(2) == QLatin1String("Bc")) else if (event.leftRef(2) == "Bc")
type = ParseData::Private::tr("Conditional branches"); type = ParseData::Private::tr("Conditional branches");
else if (event.leftRef(2) == QLatin1String("Bi")) else if (event.leftRef(2) == "Bi")
type = ParseData::Private::tr("Indirect branches"); type = ParseData::Private::tr("Indirect branches");
QStringList prettyString; QStringList prettyString;
@@ -188,14 +188,14 @@ QString ParseData::prettyStringForEvent(const QString &event)
prettyString << ParseData::Private::tr("level %1").arg(event.at(1)); prettyString << ParseData::Private::tr("level %1").arg(event.at(1));
prettyString << (isRead ? ParseData::Private::tr("read") : ParseData::Private::tr("write")); prettyString << (isRead ? ParseData::Private::tr("read") : ParseData::Private::tr("write"));
if (event.at(0) == QLatin1Char('B')) if (event.at(0) == 'B')
prettyString << (isMiss ? ParseData::Private::tr("mispredicted") : ParseData::Private::tr("executed")); prettyString << (isMiss ? ParseData::Private::tr("mispredicted") : ParseData::Private::tr("executed"));
else else
prettyString << (isMiss ? ParseData::Private::tr("miss") : ParseData::Private::tr("access")); prettyString << (isMiss ? ParseData::Private::tr("miss") : ParseData::Private::tr("access"));
// add original abbreviation // add original abbreviation
prettyString << QLatin1Char('(') + event + QLatin1Char(')'); prettyString << '(' + event + ')';
return prettyString.join(QLatin1Char(' ')); return prettyString.join(' ');
} }
QStringList ParseData::events() const QStringList ParseData::events() const
@@ -211,9 +211,9 @@ void ParseData::setEvents(const QStringList &events)
QString ParseData::prettyStringForPosition(const QString &position) QString ParseData::prettyStringForPosition(const QString &position)
{ {
if (position == QLatin1String("line")) if (position == "line")
return ParseData::Private::tr("Line:"); // as in: "line number" return ParseData::Private::tr("Line:"); // as in: "line number"
else if (position == QLatin1String("instr")) else if (position == "instr")
return ParseData::Private::tr("Instruction"); // as in: "instruction address" return ParseData::Private::tr("Instruction"); // as in: "instruction address"
return ParseData::Private::tr("Position:"); // never reached, in theory return ParseData::Private::tr("Position:"); // never reached, in theory
} }
@@ -233,7 +233,7 @@ void ParseData::setPositions(const QStringList &positions)
d->m_positions = positions; d->m_positions = positions;
d->m_lineNumberPositionIndex = -1; d->m_lineNumberPositionIndex = -1;
for (int i = 0; i < positions.size(); ++i) { for (int i = 0; i < positions.size(); ++i) {
if (positions.at(i) == QLatin1String("line")) { if (positions.at(i) == "line") {
d->m_lineNumberPositionIndex = i; d->m_lineNumberPositionIndex = i;
break; break;
} }

View File

@@ -285,11 +285,11 @@ void Parser::Private::parseHeader(QIODevice *device)
continue; continue;
} else if (line.startsWith("positions: ")) { } else if (line.startsWith("positions: ")) {
QString values = getValue(line, 11); QString values = getValue(line, 11);
data->setPositions(values.split(QLatin1Char(' '), QString::SkipEmptyParts)); data->setPositions(values.split(' ', QString::SkipEmptyParts));
addressValuesCount = data->positions().count(); addressValuesCount = data->positions().count();
} else if (line.startsWith("events: ")) { } else if (line.startsWith("events: ")) {
QString values = getValue(line, 8); QString values = getValue(line, 8);
data->setEvents(values.split(QLatin1Char(' '), QString::SkipEmptyParts)); data->setEvents(values.split(' ', QString::SkipEmptyParts));
costValuesCount = data->events().count(); costValuesCount = data->events().count();
} else if (line.startsWith("version: ")) { } else if (line.startsWith("version: ")) {
QString value = getValue(line, 9); QString value = getValue(line, 9);
@@ -312,7 +312,7 @@ void Parser::Private::parseHeader(QIODevice *device)
} else if (line.startsWith("summary: ")) { } else if (line.startsWith("summary: ")) {
QString values = getValue(line, 9); QString values = getValue(line, 9);
uint i = 0; uint i = 0;
foreach (const QStringRef &value, values.splitRef(QLatin1Char(' '), QString::SkipEmptyParts)) foreach (const QStringRef &value, values.splitRef(' ', QString::SkipEmptyParts))
data->setTotalCost(i++, value.toULongLong()); data->setTotalCost(i++, value.toULongLong());
} else if (!line.trimmed().isEmpty()) { } else if (!line.trimmed().isEmpty()) {
// handle line and exit parseHeader // handle line and exit parseHeader
@@ -530,7 +530,7 @@ void Parser::Private::parseSourceFile(const char *begin, const char *end)
if (!name.second.isEmpty()) { if (!name.second.isEmpty()) {
data->addCompressedFile(name.second, name.first); data->addCompressedFile(name.second, name.first);
if (name.second == QLatin1String("???")) if (name.second == "???")
unknownFiles << name.first; unknownFiles << name.first;
} }
@@ -560,7 +560,7 @@ void Parser::Private::parseDifferingSourceFile(const char *begin, const char *en
if (!name.second.isEmpty()) { if (!name.second.isEmpty()) {
data->addCompressedFile(name.second, name.first); data->addCompressedFile(name.second, name.first);
if (name.second == QLatin1String("???")) if (name.second == "???")
unknownFiles << name.first; unknownFiles << name.first;
} }
@@ -611,7 +611,7 @@ void Parser::Private::parseCalledSourceFile(const char *begin, const char *end)
NamePair name = parseName(begin, end); NamePair name = parseName(begin, end);
if (!name.second.isEmpty()) { if (!name.second.isEmpty()) {
data->addCompressedFile(name.second, name.first); data->addCompressedFile(name.second, name.first);
if (name.second == QLatin1String("???")) if (name.second == "???")
unknownFiles << name.first; unknownFiles << name.first;
} }

View File

@@ -80,19 +80,19 @@ QStringList CallgrindToolRunner::toolArguments() const
QTC_ASSERT(m_settings, return arguments); QTC_ASSERT(m_settings, return arguments);
if (m_settings->enableCacheSim()) if (m_settings->enableCacheSim())
arguments << QLatin1String("--cache-sim=yes"); arguments << "--cache-sim=yes";
if (m_settings->enableBranchSim()) if (m_settings->enableBranchSim())
arguments << QLatin1String("--branch-sim=yes"); arguments << "--branch-sim=yes";
if (m_settings->collectBusEvents()) if (m_settings->collectBusEvents())
arguments << QLatin1String("--collect-bus=yes"); arguments << "--collect-bus=yes";
if (m_settings->collectSystime()) if (m_settings->collectSystime())
arguments << QLatin1String("--collect-systime=yes"); arguments << "--collect-systime=yes";
if (m_markAsPaused) if (m_markAsPaused)
arguments << QLatin1String("--instr-atstart=no"); arguments << "--instr-atstart=no";
// add extra arguments // add extra arguments
if (!m_argumentForToggleCollect.isEmpty()) if (!m_argumentForToggleCollect.isEmpty())
@@ -136,7 +136,7 @@ void CallgrindToolRunner::setToggleCollectFunction(const QString &toggleCollectF
if (toggleCollectFunction.isEmpty()) if (toggleCollectFunction.isEmpty())
return; return;
m_argumentForToggleCollect = QLatin1String("--toggle-collect=") + toggleCollectFunction; m_argumentForToggleCollect = "--toggle-collect=" + toggleCollectFunction;
} }
void CallgrindToolRunner::reset() void CallgrindToolRunner::reset()

View File

@@ -63,7 +63,7 @@ QString CallgrindHelper::toPercent(float costs, const QLocale &locale)
return locale.toString(costs, 'f', 1) + locale.percent(); return locale.toString(costs, 'f', 1) + locale.percent();
if (costs > 0.009f) if (costs > 0.009f)
return locale.toString(costs, 'f', 2) + locale.percent(); return locale.toString(costs, 'f', 2) + locale.percent();
return QLatin1Char('<') + locale.toString(0.01f) + locale.percent(); return '<' + locale.toString(0.01f) + locale.percent();
} }
} // namespace Internal } // namespace Internal

View File

@@ -220,7 +220,7 @@ public:
CallgrindTool::CallgrindTool() CallgrindTool::CallgrindTool()
{ {
setObjectName(QLatin1String("CallgrindTool")); setObjectName("CallgrindTool");
m_updateTimer.setInterval(200); m_updateTimer.setInterval(200);
m_updateTimer.setSingleShot(true); m_updateTimer.setSingleShot(true);
@@ -310,14 +310,14 @@ CallgrindTool::CallgrindTool()
// //
m_visualization = new Visualization; m_visualization = new Visualization;
m_visualization->setFrameStyle(QFrame::NoFrame); m_visualization->setFrameStyle(QFrame::NoFrame);
m_visualization->setObjectName(QLatin1String("Valgrind.CallgrindTool.Visualisation")); m_visualization->setObjectName("Valgrind.CallgrindTool.Visualisation");
m_visualization->setWindowTitle(tr("Visualization")); m_visualization->setWindowTitle(tr("Visualization"));
m_visualization->setModel(&m_dataModel); m_visualization->setModel(&m_dataModel);
connect(m_visualization, &Visualization::functionActivated, connect(m_visualization, &Visualization::functionActivated,
this, &CallgrindTool::visualisationFunctionSelected); this, &CallgrindTool::visualisationFunctionSelected);
m_callersView = new CostView; m_callersView = new CostView;
m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView")); m_callersView->setObjectName("Valgrind.CallgrindTool.CallersView");
m_callersView->setWindowTitle(tr("Callers")); m_callersView->setWindowTitle(tr("Callers"));
m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView"); m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView");
m_callersView->sortByColumn(CallModel::CostColumn); m_callersView->sortByColumn(CallModel::CostColumn);
@@ -330,7 +330,7 @@ CallgrindTool::CallgrindTool()
this, &CallgrindTool::callerFunctionSelected); this, &CallgrindTool::callerFunctionSelected);
m_calleesView = new CostView; m_calleesView = new CostView;
m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView")); m_calleesView->setObjectName("Valgrind.CallgrindTool.CalleesView");
m_calleesView->setWindowTitle(tr("Callees")); m_calleesView->setWindowTitle(tr("Callees"));
m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView"); m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView");
m_calleesView->sortByColumn(CallModel::CostColumn); m_calleesView->sortByColumn(CallModel::CostColumn);
@@ -343,7 +343,7 @@ CallgrindTool::CallgrindTool()
this, &CallgrindTool::calleeFunctionSelected); this, &CallgrindTool::calleeFunctionSelected);
m_flatView = new CostView; m_flatView = new CostView;
m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView")); m_flatView->setObjectName("Valgrind.CallgrindTool.FlatView");
m_flatView->setWindowTitle(tr("Functions")); m_flatView->setWindowTitle(tr("Functions"));
m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView"); m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView");
m_flatView->sortByColumn(DataModel::SelfCostColumn); m_flatView->sortByColumn(DataModel::SelfCostColumn);
@@ -461,7 +461,7 @@ CallgrindTool::CallgrindTool()
auto button = new QToolButton; auto button = new QToolButton;
button->addActions(group->actions()); button->addActions(group->actions());
button->setPopupMode(QToolButton::InstantPopup); button->setPopupMode(QToolButton::InstantPopup);
button->setText(QLatin1String("$")); button->setText("$");
button->setToolTip(tr("Cost Format")); button->setToolTip(tr("Cost Format"));
m_perspective.addToolBarWidget(button); m_perspective.addToolBarWidget(button);
} }
@@ -469,15 +469,15 @@ CallgrindTool::CallgrindTool()
ValgrindGlobalSettings *settings = ValgrindPlugin::globalSettings(); ValgrindGlobalSettings *settings = ValgrindPlugin::globalSettings();
// Cycle detection // Cycle detection
//action = new QAction(QLatin1String("Cycle Detection"), this); ///FIXME: icon //action = new QAction("Cycle Detection", this); ///FIXME: icon
action = m_cycleDetection = new QAction(QLatin1String("O"), this); ///FIXME: icon action = m_cycleDetection = new QAction("O", this); ///FIXME: icon
action->setToolTip(tr("Enable cycle detection to properly handle recursive or circular function calls.")); action->setToolTip(tr("Enable cycle detection to properly handle recursive or circular function calls."));
action->setCheckable(true); action->setCheckable(true);
connect(action, &QAction::toggled, &m_dataModel, &DataModel::enableCycleDetection); connect(action, &QAction::toggled, &m_dataModel, &DataModel::enableCycleDetection);
connect(action, &QAction::toggled, settings, &ValgrindGlobalSettings::setDetectCycles); connect(action, &QAction::toggled, settings, &ValgrindGlobalSettings::setDetectCycles);
// Shorter template signature // Shorter template signature
action = m_shortenTemplates = new QAction(QLatin1String("<>"), this); action = m_shortenTemplates = new QAction("<>", this);
action->setToolTip(tr("Remove template parameter lists when displaying function names.")); action->setToolTip(tr("Remove template parameter lists when displaying function names."));
action->setCheckable(true); action->setCheckable(true);
connect(action, &QAction::toggled, &m_dataModel, &DataModel::setShortenTemplates); connect(action, &QAction::toggled, &m_dataModel, &DataModel::setShortenTemplates);
@@ -873,7 +873,7 @@ void CallgrindTool::handleShowCostsOfFunction()
CPlusPlus::Overview view; CPlusPlus::Overview view;
const QString qualifiedFunctionName = view.prettyName(CPlusPlus::LookupContext::fullyQualifiedName(symbol)); const QString qualifiedFunctionName = view.prettyName(CPlusPlus::LookupContext::fullyQualifiedName(symbol));
m_toggleCollectFunction = qualifiedFunctionName + QLatin1String("()"); m_toggleCollectFunction = qualifiedFunctionName + "()";
m_startAction->trigger(); m_startAction->trigger();
} }
@@ -937,7 +937,7 @@ void CallgrindTool::createTextMarks()
const QModelIndex index = m_dataModel.index(row, DataModel::InclusiveCostColumn); const QModelIndex index = m_dataModel.index(row, DataModel::InclusiveCostColumn);
QString fileName = index.data(DataModel::FileNameRole).toString(); QString fileName = index.data(DataModel::FileNameRole).toString();
if (fileName.isEmpty() || fileName == QLatin1String("???")) if (fileName.isEmpty() || fileName == "???")
continue; continue;
bool ok = false; bool ok = false;

View File

@@ -223,7 +223,7 @@ Visualization::Private::Private(Visualization *qq)
, m_model(new DataProxyModel(qq)) , m_model(new DataProxyModel(qq))
{ {
// setup scene // setup scene
m_scene.setObjectName(QLatin1String("Visualisation Scene")); m_scene.setObjectName("Visualisation Scene");
///NOTE: with size 100x100 the Qt-internal mouse selection fails... ///NOTE: with size 100x100 the Qt-internal mouse selection fails...
m_scene.setSceneRect(0, 0, 1024, 1024); m_scene.setSceneRect(0, 0, 1024, 1024);
@@ -276,7 +276,7 @@ Visualization::Visualization(QWidget *parent)
: QGraphicsView(parent) : QGraphicsView(parent)
, d(new Private(this)) , d(new Private(this))
{ {
setObjectName(QLatin1String("Visualisation View")); setObjectName("Visualisation View");
setScene(&d->m_scene); setScene(&d->m_scene);
setRenderHint(QPainter::Antialiasing); setRenderHint(QPainter::Antialiasing);
} }

View File

@@ -58,8 +58,8 @@ MemcheckErrorView::MemcheckErrorView(QWidget *parent)
m_suppressAction = new QAction(this); m_suppressAction = new QAction(this);
m_suppressAction->setText(tr("Suppress Error")); m_suppressAction->setText(tr("Suppress Error"));
const QIcon icon = Utils::Icon({ const QIcon icon = Utils::Icon({
{QLatin1String(":/utils/images/eye_open.png"), Utils::Theme::TextColorNormal}, {":/utils/images/eye_open.png", Utils::Theme::TextColorNormal},
{QLatin1String(":/valgrind/images/suppressoverlay.png"), Utils::Theme::IconsErrorColor}}, {":/valgrind/images/suppressoverlay.png", Utils::Theme::IconsErrorColor}},
Utils::Icon::Tint | Utils::Icon::PunchEdges).icon(); Utils::Icon::Tint | Utils::Icon::PunchEdges).icon();
m_suppressAction->setIcon(icon); m_suppressAction->setIcon(icon);
m_suppressAction->setShortcut(QKeySequence(Qt::Key_Delete)); m_suppressAction->setShortcut(QKeySequence(Qt::Key_Delete));

View File

@@ -276,8 +276,8 @@ static ErrorListModel::RelevantFrameFinder makeFrameFinder(const QStringList &pr
//if no frame belonging to the project was found, return the first one that is not malloc/new //if no frame belonging to the project was found, return the first one that is not malloc/new
foreach (const Frame &frame, frames) { foreach (const Frame &frame, frames) {
if (!frame.functionName().isEmpty() && frame.functionName() != QLatin1String("malloc") if (!frame.functionName().isEmpty() && frame.functionName() != "malloc"
&& !frame.functionName().startsWith(QLatin1String("operator new("))) && !frame.functionName().startsWith("operator new("))
{ {
return frame; return frame;
} }
@@ -508,7 +508,7 @@ MemcheckTool::MemcheckTool()
{ {
m_settings = ValgrindPlugin::globalSettings(); m_settings = ValgrindPlugin::globalSettings();
setObjectName(QLatin1String("MemcheckTool")); setObjectName("MemcheckTool");
m_filterProjectAction = new QAction(tr("External Errors"), this); m_filterProjectAction = new QAction(tr("External Errors"), this);
m_filterProjectAction->setToolTip( m_filterProjectAction->setToolTip(
@@ -539,7 +539,7 @@ MemcheckTool::MemcheckTool()
m_errorFilterActions.append(a); m_errorFilterActions.append(a);
m_errorView = new MemcheckErrorView; m_errorView = new MemcheckErrorView;
m_errorView->setObjectName(QLatin1String("MemcheckErrorView")); m_errorView->setObjectName("MemcheckErrorView");
m_errorView->setFrameStyle(QFrame::NoFrame); m_errorView->setFrameStyle(QFrame::NoFrame);
m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false); m_errorView->setAttribute(Qt::WA_MacShowFocusRect, false);
m_errorModel.setRelevantFrameFinder(makeFrameFinder(QStringList())); m_errorModel.setRelevantFrameFinder(makeFrameFinder(QStringList()));
@@ -551,7 +551,7 @@ MemcheckTool::MemcheckTool()
m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows); m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
m_errorView->setAutoScroll(false); m_errorView->setAutoScroll(false);
m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView")); m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView");
m_errorView->setWindowTitle(tr("Memory Issues")); m_errorView->setWindowTitle(tr("Memory Issues"));
m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr); m_perspective.addWindow(m_errorView, Perspective::SplitVertical, nullptr);

View File

@@ -79,7 +79,7 @@ static QString suppressionText(const Error &error)
newName = frame.object(); newName = frame.object();
if (!newName.isEmpty()) if (!newName.isEmpty())
sup.setName(newName + QLatin1Char('[') + sup.kind() + QLatin1Char(']')); sup.setName(newName + '[' + sup.kind() + ']');
} }
return sup.toString(); return sup.toString();
@@ -129,7 +129,7 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
suppressionsLabel->setBuddy(m_suppressionEdit); suppressionsLabel->setBuddy(m_suppressionEdit);
QFont font; QFont font;
font.setFamily(QLatin1String("Monospace")); font.setFamily("Monospace");
m_suppressionEdit->setFont(font); m_suppressionEdit->setFont(font);
m_buttonBox = new QDialogButtonBox(this); m_buttonBox = new QDialogButtonBox(this);
@@ -150,9 +150,9 @@ SuppressionDialog::SuppressionDialog(MemcheckErrorView *view, const QList<Error>
} }
m_fileChooser->setExpectedKind(Utils::PathChooser::File); m_fileChooser->setExpectedKind(Utils::PathChooser::File);
m_fileChooser->setHistoryCompleter(QLatin1String("Valgrind.Suppression.History")); m_fileChooser->setHistoryCompleter("Valgrind.Suppression.History");
m_fileChooser->setPath(defaultSuppFile.fileName()); m_fileChooser->setPath(defaultSuppFile.fileName());
m_fileChooser->setPromptDialogFilter(QLatin1String("*.supp")); m_fileChooser->setPromptDialogFilter("*.supp");
m_fileChooser->setPromptDialogTitle(tr("Select Suppression File")); m_fileChooser->setPromptDialogTitle(tr("Select Suppression File"));
QString suppressions; QString suppressions;

View File

@@ -52,7 +52,7 @@ ValgrindConfigWidget::ValgrindConfigWidget(ValgrindBaseSettings *settings, bool
m_model = new QStandardItemModel(this); m_model = new QStandardItemModel(this);
m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); m_ui->valgrindExeChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
m_ui->valgrindExeChooser->setHistoryCompleter(QLatin1String("Valgrind.Command.History")); m_ui->valgrindExeChooser->setHistoryCompleter("Valgrind.Command.History");
m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command")); m_ui->valgrindExeChooser->setPromptDialogTitle(tr("Valgrind Command"));
updateUi(); updateUi();

View File

@@ -76,7 +76,7 @@ void ValgrindToolRunner::start()
m_progress.reportStarted(); m_progress.reportStarted();
#if VALGRIND_DEBUG_OUTPUT #if VALGRIND_DEBUG_OUTPUT
emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(QLatin1Char(' '))), DebugFormat); emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(' ')), DebugFormat);
emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), DebugFormat); emit outputReceived(tr("Working directory: %1").arg(runnable().workingDirectory), DebugFormat);
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat); emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat);
#endif #endif
@@ -126,17 +126,17 @@ QStringList ValgrindToolRunner::genericToolArguments() const
QString smcCheckValue; QString smcCheckValue;
switch (m_settings->selfModifyingCodeDetection()) { switch (m_settings->selfModifyingCodeDetection()) {
case ValgrindBaseSettings::DetectSmcNo: case ValgrindBaseSettings::DetectSmcNo:
smcCheckValue = QLatin1String("none"); smcCheckValue = "none";
break; break;
case ValgrindBaseSettings::DetectSmcEverywhere: case ValgrindBaseSettings::DetectSmcEverywhere:
smcCheckValue = QLatin1String("all"); smcCheckValue = "all";
break; break;
case ValgrindBaseSettings::DetectSmcEverywhereButFile: case ValgrindBaseSettings::DetectSmcEverywhereButFile:
smcCheckValue = QLatin1String("all-non-file"); smcCheckValue = "all-non-file";
break; break;
case ValgrindBaseSettings::DetectSmcStackOnly: case ValgrindBaseSettings::DetectSmcStackOnly:
default: default:
smcCheckValue = QLatin1String("stack"); smcCheckValue = "stack";
break; break;
} }
return {"--smc-check=" + smcCheckValue}; return {"--smc-check=" + smcCheckValue};
@@ -189,7 +189,7 @@ void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::P
if (m_isStopping) if (m_isStopping)
return; return;
QObject *obj = ExtensionSystem::PluginManager::getObjectByName(QLatin1String("AppOutputPane")); QObject *obj = ExtensionSystem::PluginManager::getObjectByName("AppOutputPane");
if (IOutputPane *pane = qobject_cast<IOutputPane *>(obj)) if (IOutputPane *pane = qobject_cast<IOutputPane *>(obj))
pane->popup(IOutputPane::NoModeSwitch); pane->popup(IOutputPane::NoModeSwitch);
} }

View File

@@ -88,30 +88,30 @@ ValgrindBaseSettings::ValgrindBaseSettings(const ConfigWidgetCreator &creator)
void ValgrindBaseSettings::fromMap(const QVariantMap &map) void ValgrindBaseSettings::fromMap(const QVariantMap &map)
{ {
// General // General
setIfPresent(map, QLatin1String(valgrindExeC), &m_valgrindExecutable); setIfPresent(map, valgrindExeC, &m_valgrindExecutable);
setIfPresent(map, QLatin1String(selfModifyingCodeDetectionC), setIfPresent(map, selfModifyingCodeDetectionC,
(int*) &m_selfModifyingCodeDetection); (int*) &m_selfModifyingCodeDetection);
// Memcheck // Memcheck
setIfPresent(map, QLatin1String(numCallersC), &m_numCallers); setIfPresent(map, numCallersC, &m_numCallers);
setIfPresent(map, QLatin1String(leakCheckOnFinishC), (int*) &m_leakCheckOnFinish); setIfPresent(map, leakCheckOnFinishC, (int*) &m_leakCheckOnFinish);
setIfPresent(map, QLatin1String(showReachableC), &m_showReachable); setIfPresent(map, showReachableC, &m_showReachable);
setIfPresent(map, QLatin1String(trackOriginsC), &m_trackOrigins); setIfPresent(map, trackOriginsC, &m_trackOrigins);
setIfPresent(map, QLatin1String(filterExternalIssuesC), &m_filterExternalIssues); setIfPresent(map, filterExternalIssuesC, &m_filterExternalIssues);
if (map.contains(QLatin1String(visibleErrorKindsC))) { if (map.contains(visibleErrorKindsC)) {
m_visibleErrorKinds.clear(); m_visibleErrorKinds.clear();
foreach (const QVariant &val, map.value(QLatin1String(visibleErrorKindsC)).toList()) foreach (const QVariant &val, map.value(visibleErrorKindsC).toList())
m_visibleErrorKinds << val.toInt(); m_visibleErrorKinds << val.toInt();
} }
// Callgrind // Callgrind
setIfPresent(map, QLatin1String(callgrindEnableCacheSimC), &m_enableCacheSim); setIfPresent(map, callgrindEnableCacheSimC, &m_enableCacheSim);
setIfPresent(map, QLatin1String(callgrindEnableBranchSimC), &m_enableBranchSim); setIfPresent(map, callgrindEnableBranchSimC, &m_enableBranchSim);
setIfPresent(map, QLatin1String(callgrindCollectSystimeC), &m_collectSystime); setIfPresent(map, callgrindCollectSystimeC, &m_collectSystime);
setIfPresent(map, QLatin1String(callgrindCollectBusEventsC), &m_collectBusEvents); setIfPresent(map, callgrindCollectBusEventsC, &m_collectBusEvents);
setIfPresent(map, QLatin1String(callgrindEnableEventToolTipsC), &m_enableEventToolTips); setIfPresent(map, callgrindEnableEventToolTipsC, &m_enableEventToolTips);
setIfPresent(map, QLatin1String(callgrindMinimumCostRatioC), &m_minimumInclusiveCostRatio); setIfPresent(map, callgrindMinimumCostRatioC, &m_minimumInclusiveCostRatio);
setIfPresent(map, QLatin1String(callgrindVisualisationMinimumCostRatioC), setIfPresent(map, callgrindVisualisationMinimumCostRatioC,
&m_visualisationMinimumInclusiveCostRatio); &m_visualisationMinimumInclusiveCostRatio);
emit changed(); emit changed();
@@ -120,28 +120,28 @@ void ValgrindBaseSettings::fromMap(const QVariantMap &map)
void ValgrindBaseSettings::toMap(QVariantMap &map) const void ValgrindBaseSettings::toMap(QVariantMap &map) const
{ {
// General // General
map.insert(QLatin1String(valgrindExeC), m_valgrindExecutable); map.insert(valgrindExeC, m_valgrindExecutable);
map.insert(QLatin1String(selfModifyingCodeDetectionC), m_selfModifyingCodeDetection); map.insert(selfModifyingCodeDetectionC, m_selfModifyingCodeDetection);
// Memcheck // Memcheck
map.insert(QLatin1String(numCallersC), m_numCallers); map.insert(numCallersC, m_numCallers);
map.insert(QLatin1String(leakCheckOnFinishC), m_leakCheckOnFinish); map.insert(leakCheckOnFinishC, m_leakCheckOnFinish);
map.insert(QLatin1String(showReachableC), m_showReachable); map.insert(showReachableC, m_showReachable);
map.insert(QLatin1String(trackOriginsC), m_trackOrigins); map.insert(trackOriginsC, m_trackOrigins);
map.insert(QLatin1String(filterExternalIssuesC), m_filterExternalIssues); map.insert(filterExternalIssuesC, m_filterExternalIssues);
QVariantList errorKinds; QVariantList errorKinds;
foreach (int i, m_visibleErrorKinds) foreach (int i, m_visibleErrorKinds)
errorKinds << i; errorKinds << i;
map.insert(QLatin1String(visibleErrorKindsC), errorKinds); map.insert(visibleErrorKindsC, errorKinds);
// Callgrind // Callgrind
map.insert(QLatin1String(callgrindEnableCacheSimC), m_enableCacheSim); map.insert(callgrindEnableCacheSimC, m_enableCacheSim);
map.insert(QLatin1String(callgrindEnableBranchSimC), m_enableBranchSim); map.insert(callgrindEnableBranchSimC, m_enableBranchSim);
map.insert(QLatin1String(callgrindCollectSystimeC), m_collectSystime); map.insert(callgrindCollectSystimeC, m_collectSystime);
map.insert(QLatin1String(callgrindCollectBusEventsC), m_collectBusEvents); map.insert(callgrindCollectBusEventsC, m_collectBusEvents);
map.insert(QLatin1String(callgrindEnableEventToolTipsC), m_enableEventToolTips); map.insert(callgrindEnableEventToolTipsC, m_enableEventToolTips);
map.insert(QLatin1String(callgrindMinimumCostRatioC), m_minimumInclusiveCostRatio); map.insert(callgrindMinimumCostRatioC, m_minimumInclusiveCostRatio);
map.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), map.insert(callgrindVisualisationMinimumCostRatioC,
m_visualisationMinimumInclusiveCostRatio); m_visualisationMinimumInclusiveCostRatio);
} }
@@ -299,16 +299,16 @@ void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
ValgrindBaseSettings::fromMap(map); ValgrindBaseSettings::fromMap(map);
// Memcheck // Memcheck
m_suppressionFiles = map.value(QLatin1String(suppressionFilesC)).toStringList(); m_suppressionFiles = map.value(suppressionFilesC).toStringList();
m_lastSuppressionDirectory = map.value(QLatin1String(lastSuppressionDirectoryC)).toString(); m_lastSuppressionDirectory = map.value(lastSuppressionDirectoryC).toString();
m_lastSuppressionHistory = map.value(QLatin1String(lastSuppressionHistoryC)).toStringList(); m_lastSuppressionHistory = map.value(lastSuppressionHistoryC).toStringList();
// Callgrind // Callgrind
// special code as the default one does not cope with the enum properly // special code as the default one does not cope with the enum properly
if (map.contains(QLatin1String(callgrindCostFormatC))) if (map.contains(callgrindCostFormatC))
m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(QLatin1String(callgrindCostFormatC)).toInt()); m_costFormat = static_cast<CostDelegate::CostFormat>(map.value(callgrindCostFormatC).toInt());
setIfPresent(map, QLatin1String(callgrindCycleDetectionC), &m_detectCycles); setIfPresent(map, callgrindCycleDetectionC, &m_detectCycles);
setIfPresent(map, QLatin1String(callgrindShortenTemplates), &m_shortenTemplates); setIfPresent(map, callgrindShortenTemplates, &m_shortenTemplates);
} }
void ValgrindGlobalSettings::toMap(QVariantMap &map) const void ValgrindGlobalSettings::toMap(QVariantMap &map) const
@@ -316,14 +316,14 @@ void ValgrindGlobalSettings::toMap(QVariantMap &map) const
ValgrindBaseSettings::toMap(map); ValgrindBaseSettings::toMap(map);
// Memcheck // Memcheck
map.insert(QLatin1String(suppressionFilesC), m_suppressionFiles); map.insert(suppressionFilesC, m_suppressionFiles);
map.insert(QLatin1String(lastSuppressionDirectoryC), m_lastSuppressionDirectory); map.insert(lastSuppressionDirectoryC, m_lastSuppressionDirectory);
map.insert(QLatin1String(lastSuppressionHistoryC), m_lastSuppressionHistory); map.insert(lastSuppressionHistoryC, m_lastSuppressionHistory);
// Callgrind // Callgrind
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat); map.insert(callgrindCostFormatC, m_costFormat);
map.insert(QLatin1String(callgrindCycleDetectionC), m_detectCycles); map.insert(callgrindCycleDetectionC, m_detectCycles);
map.insert(QLatin1String(callgrindShortenTemplates), m_shortenTemplates); map.insert(callgrindShortenTemplates, m_shortenTemplates);
} }
// //
@@ -375,40 +375,40 @@ void ValgrindGlobalSettings::readSettings()
QVariantMap defaults; QVariantMap defaults;
// General // General
defaults.insert(QLatin1String(valgrindExeC), QLatin1String("valgrind")); defaults.insert(valgrindExeC, "valgrind");
defaults.insert(QLatin1String(selfModifyingCodeDetectionC), DetectSmcStackOnly); defaults.insert(selfModifyingCodeDetectionC, DetectSmcStackOnly);
// Memcheck // Memcheck
defaults.insert(QLatin1String(numCallersC), 25); defaults.insert(numCallersC, 25);
defaults.insert(QLatin1String(leakCheckOnFinishC), LeakCheckOnFinishSummaryOnly); defaults.insert(leakCheckOnFinishC, LeakCheckOnFinishSummaryOnly);
defaults.insert(QLatin1String(showReachableC), false); defaults.insert(showReachableC, false);
defaults.insert(QLatin1String(trackOriginsC), true); defaults.insert(trackOriginsC, true);
defaults.insert(QLatin1String(filterExternalIssuesC), true); defaults.insert(filterExternalIssuesC, true);
QVariantList defaultErrorKinds; QVariantList defaultErrorKinds;
for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i) for (int i = 0; i < Valgrind::XmlProtocol::MemcheckErrorKindCount; ++i)
defaultErrorKinds << i; defaultErrorKinds << i;
defaults.insert(QLatin1String(visibleErrorKindsC), defaultErrorKinds); defaults.insert(visibleErrorKindsC, defaultErrorKinds);
defaults.insert(QLatin1String(suppressionFilesC), QStringList()); defaults.insert(suppressionFilesC, QStringList());
defaults.insert(QLatin1String(lastSuppressionDirectoryC), QString()); defaults.insert(lastSuppressionDirectoryC, QString());
defaults.insert(QLatin1String(lastSuppressionHistoryC), QStringList()); defaults.insert(lastSuppressionHistoryC, QStringList());
// Callgrind // Callgrind
defaults.insert(QLatin1String(callgrindEnableCacheSimC), false); defaults.insert(callgrindEnableCacheSimC, false);
defaults.insert(QLatin1String(callgrindEnableBranchSimC), false); defaults.insert(callgrindEnableBranchSimC, false);
defaults.insert(QLatin1String(callgrindCollectSystimeC), false); defaults.insert(callgrindCollectSystimeC, false);
defaults.insert(QLatin1String(callgrindCollectBusEventsC), false); defaults.insert(callgrindCollectBusEventsC, false);
defaults.insert(QLatin1String(callgrindEnableEventToolTipsC), true); defaults.insert(callgrindEnableEventToolTipsC, true);
defaults.insert(QLatin1String(callgrindMinimumCostRatioC), 0.01); defaults.insert(callgrindMinimumCostRatioC, 0.01);
defaults.insert(QLatin1String(callgrindVisualisationMinimumCostRatioC), 10.0); defaults.insert(callgrindVisualisationMinimumCostRatioC, 10.0);
defaults.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative); defaults.insert(callgrindCostFormatC, CostDelegate::FormatRelative);
defaults.insert(QLatin1String(callgrindCycleDetectionC), true); defaults.insert(callgrindCycleDetectionC, true);
defaults.insert(QLatin1String(callgrindShortenTemplates), true); defaults.insert(callgrindShortenTemplates, true);
// Read stored values // Read stored values
QSettings *settings = Core::ICore::settings(); QSettings *settings = Core::ICore::settings();
settings->beginGroup(QLatin1String(groupC)); settings->beginGroup(groupC);
QVariantMap map = defaults; QVariantMap map = defaults;
for (QVariantMap::ConstIterator it = defaults.constBegin(); it != defaults.constEnd(); ++it) for (QVariantMap::ConstIterator it = defaults.constBegin(); it != defaults.constEnd(); ++it)
map.insert(it.key(), settings->value(it.key(), it.value())); map.insert(it.key(), settings->value(it.key(), it.value()));
@@ -420,7 +420,7 @@ void ValgrindGlobalSettings::readSettings()
void ValgrindGlobalSettings::writeSettings() const void ValgrindGlobalSettings::writeSettings() const
{ {
QSettings *settings = Core::ICore::settings(); QSettings *settings = Core::ICore::settings();
settings->beginGroup(QLatin1String(groupC)); settings->beginGroup(groupC);
QVariantMap map; QVariantMap map;
toMap(map); toMap(map);
for (QVariantMap::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it) for (QVariantMap::ConstIterator it = map.constBegin(); it != map.constEnd(); ++it)
@@ -480,8 +480,8 @@ void ValgrindProjectSettings::fromMap(const QVariantMap &map)
ValgrindBaseSettings::fromMap(map); ValgrindBaseSettings::fromMap(map);
// Memcheck // Memcheck
setIfPresent(map, QLatin1String(addedSuppressionFilesC), &m_addedSuppressionFiles); setIfPresent(map, addedSuppressionFilesC, &m_addedSuppressionFiles);
setIfPresent(map, QLatin1String(removedSuppressionFilesC), &m_disabledGlobalSuppressionFiles); setIfPresent(map, removedSuppressionFilesC, &m_disabledGlobalSuppressionFiles);
} }
void ValgrindProjectSettings::toMap(QVariantMap &map) const void ValgrindProjectSettings::toMap(QVariantMap &map) const
@@ -489,8 +489,8 @@ void ValgrindProjectSettings::toMap(QVariantMap &map) const
ValgrindBaseSettings::toMap(map); ValgrindBaseSettings::toMap(map);
// Memcheck // Memcheck
map.insert(QLatin1String(addedSuppressionFilesC), m_addedSuppressionFiles); map.insert(addedSuppressionFilesC, m_addedSuppressionFiles);
map.insert(QLatin1String(removedSuppressionFilesC), m_disabledGlobalSuppressionFiles); map.insert(removedSuppressionFilesC, m_disabledGlobalSuppressionFiles);
} }
// //

View File

@@ -63,7 +63,7 @@ static bool on64bit()
static QString srcDirForApp(const QString &app) static QString srcDirForApp(const QString &app)
{ {
return QDir::cleanPath(appSrcDir + QLatin1Char('/') + app); return QDir::cleanPath(appSrcDir + '/' + app);
} }
ValgrindTestRunnerTest::ValgrindTestRunnerTest(QObject *parent) ValgrindTestRunnerTest::ValgrindTestRunnerTest(QObject *parent)
@@ -147,7 +147,7 @@ void ValgrindTestRunnerTest::init()
void ValgrindTestRunnerTest::testLeak1() void ValgrindTestRunnerTest::testLeak1()
{ {
const QString binary = runTestBinary(QLatin1String("leak1/leak1")); const QString binary = runTestBinary("leak1/leak1");
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -166,24 +166,24 @@ void ValgrindTestRunnerTest::testLeak1()
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
if (on64bit()) if (on64bit())
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); QCOMPARE(frame.functionName(), "operator new(unsigned long)");
else else
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)")); QCOMPARE(frame.functionName(), "operator new(unsigned int)");
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 5 + HEADER_LENGTH); QCOMPARE(frame.line(), 5 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak1")); QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak1"));
} }
} }
void ValgrindTestRunnerTest::testLeak2() void ValgrindTestRunnerTest::testLeak2()
{ {
const QString binary = runTestBinary(QLatin1String("leak2/leak2")); const QString binary = runTestBinary("leak2/leak2");
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -200,30 +200,30 @@ void ValgrindTestRunnerTest::testLeak2()
QCOMPARE(stack.frames().count(), 3); QCOMPARE(stack.frames().count(), 3);
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
QCOMPARE(frame.functionName(), QLatin1String("malloc")); QCOMPARE(frame.functionName(), "malloc");
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("strdup")); QCOMPARE(frame.functionName(), "strdup");
} }
{ {
const Frame frame = stack.frames().at(2); const Frame frame = stack.frames().at(2);
if (on64bit()) { if (on64bit()) {
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 7 + HEADER_LENGTH); QCOMPARE(frame.line(), 7 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak2")); QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak2"));
} else { } else {
QCOMPARE(frame.functionName(), QLatin1String("(below main)")); QCOMPARE(frame.functionName(), "(below main)");
} }
} }
} }
void ValgrindTestRunnerTest::testLeak3() void ValgrindTestRunnerTest::testLeak3()
{ {
const QString binary = runTestBinary(QLatin1String("leak3/leak3"), QStringList() << "--show-reachable=yes"); const QString binary = runTestBinary("leak3/leak3", QStringList{"--show-reachable=yes"});
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -240,23 +240,23 @@ void ValgrindTestRunnerTest::testLeak3()
QCOMPARE(stack.frames().count(), 3); QCOMPARE(stack.frames().count(), 3);
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
QCOMPARE(frame.functionName(), QLatin1String("malloc")); QCOMPARE(frame.functionName(), "malloc");
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("strdup")); QCOMPARE(frame.functionName(), "strdup");
} }
{ {
const Frame frame = stack.frames().at(2); const Frame frame = stack.frames().at(2);
if (on64bit()) { if (on64bit()) {
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 7 + HEADER_LENGTH); QCOMPARE(frame.line(), 7 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak3")); QCOMPARE(QDir::cleanPath(frame.directory()), srcDirForApp("leak3"));
} else { } else {
QCOMPARE(frame.functionName(), QLatin1String("(below main)")); QCOMPARE(frame.functionName(), "(below main)");
} }
} }
} }
@@ -264,7 +264,7 @@ void ValgrindTestRunnerTest::testLeak3()
void ValgrindTestRunnerTest::testLeak4() void ValgrindTestRunnerTest::testLeak4()
{ {
const QString app("leak4"); const QString app("leak4");
const QString binary = runTestBinary(app + QLatin1Char('/') + app, const QString binary = runTestBinary(app + '/' + app,
QStringList() << "--show-reachable=yes"); QStringList() << "--show-reachable=yes");
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
@@ -290,26 +290,26 @@ void ValgrindTestRunnerTest::testLeak4()
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
if (on64bit()) if (on64bit())
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); QCOMPARE(frame.functionName(), "operator new(unsigned long)");
else else
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)")); QCOMPARE(frame.functionName(), "operator new(unsigned int)");
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("Foo::Foo()")); QCOMPARE(frame.functionName(), "Foo::Foo()");
QCOMPARE(frame.line(), 6 + HEADER_LENGTH); QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
{ {
const Frame frame = stack.frames().at(2); const Frame frame = stack.frames().at(2);
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 14 + HEADER_LENGTH); QCOMPARE(frame.line(), 14 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -331,17 +331,17 @@ void ValgrindTestRunnerTest::testLeak4()
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
if (on64bit()) if (on64bit())
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); QCOMPARE(frame.functionName(), "operator new(unsigned long)");
else else
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)")); QCOMPARE(frame.functionName(), "operator new(unsigned int)");
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 14 + HEADER_LENGTH); QCOMPARE(frame.line(), 14 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -350,7 +350,7 @@ void ValgrindTestRunnerTest::testLeak4()
void ValgrindTestRunnerTest::testUninit1() void ValgrindTestRunnerTest::testUninit1()
{ {
const QString app("uninit1"); const QString app("uninit1");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -369,11 +369,11 @@ void ValgrindTestRunnerTest::testUninit1()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 4 + HEADER_LENGTH); QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
//BEGIN second stack //BEGIN second stack
@@ -383,11 +383,11 @@ void ValgrindTestRunnerTest::testUninit1()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 2 + HEADER_LENGTH); QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -396,7 +396,7 @@ void ValgrindTestRunnerTest::testUninit2()
{ {
const QString app("uninit2"); const QString app("uninit2");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -417,11 +417,11 @@ void ValgrindTestRunnerTest::testUninit2()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 4 + HEADER_LENGTH); QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
//BEGIN second stack //BEGIN second stack
@@ -431,11 +431,11 @@ void ValgrindTestRunnerTest::testUninit2()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 2 + HEADER_LENGTH); QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -450,11 +450,11 @@ void ValgrindTestRunnerTest::testUninit2()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 4 + HEADER_LENGTH); QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -463,7 +463,7 @@ void ValgrindTestRunnerTest::testUninit3()
{ {
const QString app("uninit3"); const QString app("uninit3");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -484,11 +484,11 @@ void ValgrindTestRunnerTest::testUninit3()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 4 + HEADER_LENGTH); QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
//BEGIN second stack //BEGIN second stack
@@ -498,11 +498,11 @@ void ValgrindTestRunnerTest::testUninit3()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 2 + HEADER_LENGTH); QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -517,11 +517,11 @@ void ValgrindTestRunnerTest::testUninit3()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 4 + HEADER_LENGTH); QCOMPARE(frame.line(), 4 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -529,7 +529,7 @@ void ValgrindTestRunnerTest::testUninit3()
void ValgrindTestRunnerTest::testSyscall() void ValgrindTestRunnerTest::testSyscall()
{ {
const QString app("syscall"); const QString app("syscall");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -550,25 +550,25 @@ void ValgrindTestRunnerTest::testSyscall()
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
QCOMPARE(frame.functionName(), QLatin1String("_Exit")); QCOMPARE(frame.functionName(), "_Exit");
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("__run_exit_handlers")); QCOMPARE(frame.functionName(), "__run_exit_handlers");
} }
{ {
const Frame frame = stack.frames().at(2); const Frame frame = stack.frames().at(2);
QCOMPARE(frame.functionName(), QLatin1String("exit")); QCOMPARE(frame.functionName(), "exit");
} }
{ {
const Frame frame = stack.frames().at(3); const Frame frame = stack.frames().at(3);
QCOMPARE(frame.functionName(), QLatin1String("(below main)")); QCOMPARE(frame.functionName(), "(below main)");
} }
} else { } else {
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
QCOMPARE(frame.functionName(), QLatin1String("_Exit")); QCOMPARE(frame.functionName(), "_Exit");
} }
} }
} }
@@ -579,11 +579,11 @@ void ValgrindTestRunnerTest::testSyscall()
QCOMPARE(stack.frames().count(), 1); QCOMPARE(stack.frames().count(), 1);
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 2 + HEADER_LENGTH); QCOMPARE(frame.line(), 2 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -591,7 +591,7 @@ void ValgrindTestRunnerTest::testSyscall()
void ValgrindTestRunnerTest::testFree1() void ValgrindTestRunnerTest::testFree1()
{ {
const QString app("free1"); const QString app("free1");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -611,15 +611,15 @@ void ValgrindTestRunnerTest::testFree1()
{ {
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("operator delete(void*)")); QCOMPARE(frame.functionName(), "operator delete(void*)");
} }
{ {
const Frame frame = stack.frames().last(); const Frame frame = stack.frames().last();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 7 + HEADER_LENGTH); QCOMPARE(frame.line(), 7 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -631,15 +631,15 @@ void ValgrindTestRunnerTest::testFree1()
{ {
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("operator delete(void*)")); QCOMPARE(frame.functionName(), "operator delete(void*)");
} }
{ {
const Frame frame = stack.frames().last(); const Frame frame = stack.frames().last();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 6 + HEADER_LENGTH); QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -648,7 +648,7 @@ void ValgrindTestRunnerTest::testFree1()
void ValgrindTestRunnerTest::testFree2() void ValgrindTestRunnerTest::testFree2()
{ {
const QString app("free2"); const QString app("free2");
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -668,15 +668,15 @@ void ValgrindTestRunnerTest::testFree2()
{ {
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
QCOMPARE(frame.functionName(), QLatin1String("free")); QCOMPARE(frame.functionName(), "free");
} }
{ {
const Frame frame = stack.frames().last(); const Frame frame = stack.frames().last();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 6 + HEADER_LENGTH); QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -690,17 +690,17 @@ void ValgrindTestRunnerTest::testFree2()
{ {
const Frame frame = stack.frames().first(); const Frame frame = stack.frames().first();
if (on64bit()) if (on64bit())
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); QCOMPARE(frame.functionName(), "operator new(unsigned long)");
else else
QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned int)")); QCOMPARE(frame.functionName(), "operator new(unsigned int)");
} }
{ {
const Frame frame = stack.frames().last(); const Frame frame = stack.frames().last();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 5 + HEADER_LENGTH); QCOMPARE(frame.line(), 5 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }
@@ -710,7 +710,7 @@ void ValgrindTestRunnerTest::testInvalidjump()
{ {
const QString app("invalidjump"); const QString app("invalidjump");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -731,7 +731,7 @@ void ValgrindTestRunnerTest::testInvalidjump()
} }
{ {
const Frame frame = stack.frames().at(1); const Frame frame = stack.frames().at(1);
QCOMPARE(frame.functionName(), QLatin1String("(below main)")); QCOMPARE(frame.functionName(), "(below main)");
} }
} }
@@ -739,7 +739,7 @@ void ValgrindTestRunnerTest::testOverlap()
{ {
const QString app("overlap"); const QString app("overlap");
m_expectCrash = true; m_expectCrash = true;
const QString binary = runTestBinary(app + QLatin1Char('/') + app); const QString binary = runTestBinary(app + '/' + app);
if (binary.isEmpty()) if (binary.isEmpty())
QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps " QSKIP("You need to pass BUILD_TESTS when building Qt Creator or build valgrind testapps "
"manually before executing this test."); "manually before executing this test.");
@@ -756,15 +756,15 @@ void ValgrindTestRunnerTest::testOverlap()
QCOMPARE(stack.frames().count(), 2); QCOMPARE(stack.frames().count(), 2);
{ {
const Frame frame = stack.frames().at(0); const Frame frame = stack.frames().at(0);
QVERIFY(frame.functionName().startsWith(QLatin1String("memcpy"))); QVERIFY(frame.functionName().startsWith("memcpy"));
} }
{ {
const Frame frame = stack.frames().last(); const Frame frame = stack.frames().last();
QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.functionName(), "main");
QCOMPARE(frame.line(), 6 + HEADER_LENGTH); QCOMPARE(frame.line(), 6 + HEADER_LENGTH);
QCOMPARE(frame.object(), binary); QCOMPARE(frame.object(), binary);
QCOMPARE(frame.fileName(), QLatin1String("main.cpp")); QCOMPARE(frame.fileName(), "main.cpp");
QCOMPARE(QDir::cleanPath(frame.directory()), srcDir); QCOMPARE(QDir::cleanPath(frame.directory()), srcDir);
} }
} }

View File

@@ -121,7 +121,7 @@ static QString makeFrameName(const Frame &frame, bool withLocation)
path = QFileInfo(path).canonicalFilePath(); path = QFileInfo(path).canonicalFilePath();
if (frame.line() != -1) if (frame.line() != -1)
path += QLatin1Char(':') + QString::number(frame.line()); path += ':' + QString::number(frame.line());
if (!fn.isEmpty()) { if (!fn.isEmpty()) {
const QString location = withLocation || path == frame.object() const QString location = withLocation || path == frame.object()
@@ -274,7 +274,7 @@ QVariant FrameItem::data(int column, int role) const
const int padding = static_cast<int>(std::log10(parent()->childCount())) const int padding = static_cast<int>(std::log10(parent()->childCount()))
- static_cast<int>(std::log10(row)); - static_cast<int>(std::log10(row));
return QString::fromLatin1("%1%2: %3") return QString::fromLatin1("%1%2: %3")
.arg(QString(padding, QLatin1Char(' '))) .arg(QString(padding, ' '))
.arg(row) .arg(row)
.arg(makeFrameName(m_frame, false)); .arg(makeFrameName(m_frame, false));
} }

View File

@@ -145,7 +145,7 @@ QString Frame::filePath() const
{ {
QString f; QString f;
if (!directory().isEmpty()) if (!directory().isEmpty())
f.append(directory()).append(QLatin1Char('/')); f.append(directory()).append('/');
return f.append(fileName()); return f.append(fileName());
} }

View File

@@ -41,7 +41,7 @@ QString toolTipForFrame(const Frame &frame)
if (!frame.fileName().isEmpty()) { if (!frame.fileName().isEmpty()) {
location = frame.filePath(); location = frame.filePath();
if (frame.line() > 0) if (frame.line() > 0)
location += QLatin1Char(':') + QString::number(frame.line()); location += ':' + QString::number(frame.line());
} }
typedef QPair<QString, QString> StringPair; typedef QPair<QString, QString> StringPair;
@@ -60,19 +60,18 @@ QString toolTipForFrame(const Frame &frame)
if (!frame.object().isEmpty()) if (!frame.object().isEmpty())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object()); lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
QString html = QLatin1String("<html>" QString html = "<html><head>"
"<head>"
"<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n" "<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n"
"<body><dl>"); "</head><body><dl>";
foreach (const StringPair &pair, lines) { foreach (const StringPair &pair, lines) {
html += QLatin1String("<dt>"); html += "<dt>";
html += pair.first; html += pair.first;
html += QLatin1String("</dt><dd>"); html += "</dt><dd>";
html += pair.second; html += pair.second;
html += QLatin1String("</dd>\n"); html += "</dd>\n";
} }
html += QLatin1String("</dl></body></html>"); html += "</dl></body></html>";
return html; return html;
} }

View File

@@ -128,17 +128,17 @@ private:
}; };
#undef ADD_ENUM #undef ADD_ENUM
#define ADD_ENUM(tool,enumV) { errorKindsByName_##tool.insert(QLatin1String(#enumV), enumV); } #define ADD_ENUM(tool,enumV) { errorKindsByName_##tool.insert(#enumV, enumV); }
Parser::Private::Private(Parser *qq) Parser::Private::Private(Parser *qq)
: q(qq) : q(qq)
{ {
tool = Parser::Unknown; tool = Parser::Unknown;
toolsByName.insert(QLatin1String("memcheck"), Parser::Memcheck); toolsByName.insert("memcheck", Parser::Memcheck);
toolsByName.insert(QLatin1String("ptrcheck"), Parser::Ptrcheck); toolsByName.insert("ptrcheck", Parser::Ptrcheck);
toolsByName.insert(QLatin1String("exp-ptrcheck"), Parser::Ptrcheck); toolsByName.insert("exp-ptrcheck", Parser::Ptrcheck);
toolsByName.insert(QLatin1String("helgrind"), Parser::Helgrind); toolsByName.insert("helgrind", Parser::Helgrind);
ADD_ENUM(memcheck, ClientCheck) ADD_ENUM(memcheck, ClientCheck)
ADD_ENUM(memcheck, InvalidFree) ADD_ENUM(memcheck, InvalidFree)
@@ -306,14 +306,14 @@ XWhat Parser::Private::parseXWhat()
if (reader.isEndElement()) if (reader.isEndElement())
break; break;
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("text")) if (name == "text")
what.text = blockingReadElementText(); what.text = blockingReadElementText();
else if (name == QLatin1String("leakedbytes")) else if (name == "leakedbytes")
what.leakedbytes = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedbytes")); what.leakedbytes = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedbytes");
else if (name == QLatin1String("leakedblocks")) else if (name == "leakedblocks")
what.leakedblocks = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/leakedblocks")); what.leakedblocks = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedblocks");
else if (name == QLatin1String("hthreadid")) else if (name == "hthreadid")
what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xwhat[memcheck]/hthreadid")); what.hthreadid = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/hthreadid");
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
} }
@@ -328,16 +328,16 @@ XauxWhat Parser::Private::parseXauxWhat()
if (reader.isEndElement()) if (reader.isEndElement())
break; break;
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("text")) if (name == "text")
what.text = blockingReadElementText(); what.text = blockingReadElementText();
else if (name == QLatin1String("file")) else if (name == "file")
what.file = blockingReadElementText(); what.file = blockingReadElementText();
else if (name == QLatin1String("dir")) else if (name == "dir")
what.dir = blockingReadElementText(); what.dir = blockingReadElementText();
else if (name == QLatin1String("line")) else if (name == "line")
what.line = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/line")); what.line = parseInt64(blockingReadElementText(), "error/xauxwhat/line");
else if (name == QLatin1String("hthreadid")) else if (name == "hthreadid")
what.hthreadid = parseInt64(blockingReadElementText(), QLatin1String("error/xauxwhat/hthreadid")); what.hthreadid = parseInt64(blockingReadElementText(), "error/xauxwhat/hthreadid");
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
} }
@@ -395,9 +395,9 @@ int Parser::Private::parseErrorKind(const QString &kind)
static Status::State parseState(const QString &state) static Status::State parseState(const QString &state)
{ {
if (state == QLatin1String("RUNNING")) if (state == "RUNNING")
return Status::Running; return Status::Running;
if (state == QLatin1String("FINISHED")) if (state == "FINISHED")
return Status::Finished; return Status::Finished;
throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser", throw ParserException(QCoreApplication::translate("Valgrind::XmlProtocol::Parser",
"Unknown state \"%1\"").arg(state)); "Unknown state \"%1\"").arg(state));
@@ -436,27 +436,27 @@ void Parser::Private::parseError()
if (reader.isStartElement()) if (reader.isStartElement())
lastAuxWhat++; lastAuxWhat++;
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("unique")) { if (name == "unique") {
e.setUnique(parseHex(blockingReadElementText(), QLatin1String("unique"))); e.setUnique(parseHex(blockingReadElementText(), "unique"));
} else if (name == QLatin1String("tid")) { } else if (name == "tid") {
e.setTid(parseInt64(blockingReadElementText(), QLatin1String("error/tid"))); e.setTid(parseInt64(blockingReadElementText(), "error/tid"));
} else if (name == QLatin1String("kind")) { //TODO this is memcheck-specific: } else if (name == "kind") { //TODO this is memcheck-specific:
e.setKind(parseErrorKind(blockingReadElementText())); e.setKind(parseErrorKind(blockingReadElementText()));
} else if (name == QLatin1String("suppression")) { } else if (name == "suppression") {
e.setSuppression(parseSuppression()); e.setSuppression(parseSuppression());
} else if (name == QLatin1String("xwhat")) { } else if (name == "xwhat") {
const XWhat xw = parseXWhat(); const XWhat xw = parseXWhat();
e.setWhat(xw.text); e.setWhat(xw.text);
e.setLeakedBlocks(xw.leakedblocks); e.setLeakedBlocks(xw.leakedblocks);
e.setLeakedBytes(xw.leakedbytes); e.setLeakedBytes(xw.leakedbytes);
e.setHelgrindThreadId(xw.hthreadid); e.setHelgrindThreadId(xw.hthreadid);
} else if (name == QLatin1String("what")) { } else if (name == "what") {
e.setWhat(blockingReadElementText()); e.setWhat(blockingReadElementText());
} else if (name == QLatin1String("xauxwhat")) { } else if (name == "xauxwhat") {
if (!currentAux.text.isEmpty()) if (!currentAux.text.isEmpty())
auxs.push_back(currentAux); auxs.push_back(currentAux);
currentAux = parseXauxWhat(); currentAux = parseXauxWhat();
} else if (name == QLatin1String("auxwhat")) { } else if (name == "auxwhat") {
const QString aux = blockingReadElementText(); const QString aux = blockingReadElementText();
//concatenate multiple consecutive <auxwhat> tags //concatenate multiple consecutive <auxwhat> tags
if (lastAuxWhat > 1) { if (lastAuxWhat > 1) {
@@ -466,11 +466,11 @@ void Parser::Private::parseError()
currentAux.text = aux; currentAux.text = aux;
} else { } else {
if (!currentAux.text.isEmpty()) if (!currentAux.text.isEmpty())
currentAux.text.append(QLatin1Char(' ')); currentAux.text.append(' ');
currentAux.text.append(aux); currentAux.text.append(aux);
} }
lastAuxWhat = 0; lastAuxWhat = 0;
} else if (name == QLatin1String("stack")) { } else if (name == "stack") {
frames.push_back(parseStack()); frames.push_back(parseStack());
} else if (reader.isStartElement()) { } else if (reader.isStartElement()) {
reader.skipCurrentElement(); reader.skipCurrentElement();
@@ -507,18 +507,18 @@ Frame Parser::Private::parseFrame()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("ip")) if (name == "ip")
frame.setInstructionPointer(parseHex(blockingReadElementText(), QLatin1String("error/frame/ip"))); frame.setInstructionPointer(parseHex(blockingReadElementText(), "error/frame/ip"));
else if (name == QLatin1String("obj")) else if (name == "obj")
frame.setObject(blockingReadElementText()); frame.setObject(blockingReadElementText());
else if (name == QLatin1String("fn")) else if (name == "fn")
frame.setFunctionName( blockingReadElementText()); frame.setFunctionName( blockingReadElementText());
else if (name == QLatin1String("dir")) else if (name == "dir")
frame.setDirectory(blockingReadElementText()); frame.setDirectory(blockingReadElementText());
else if (name == QLatin1String("file")) else if (name == "file")
frame.setFileName(blockingReadElementText()); frame.setFileName(blockingReadElementText());
else if (name == QLatin1String("line")) else if (name == "line")
frame.setLine(parseInt64(blockingReadElementText(), QLatin1String("error/frame/line"))); frame.setLine(parseInt64(blockingReadElementText(), "error/frame/line"));
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
} }
@@ -537,9 +537,9 @@ void Parser::Private::parseAnnounceThread()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("hthreadid")) if (name == "hthreadid")
at.setHelgrindThreadId(parseInt64(blockingReadElementText(), QLatin1String("announcethread/hthreadid"))); at.setHelgrindThreadId(parseInt64(blockingReadElementText(), "announcethread/hthreadid"));
else if (name == QLatin1String("stack")) else if (name == "stack")
at.setStack(parseStack()); at.setStack(parseStack());
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
@@ -556,7 +556,7 @@ void Parser::Private::parseErrorCounts()
if (reader.isEndElement()) if (reader.isEndElement())
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
if (reader.name() == QLatin1String("pair")) { if (reader.name() == "pair") {
qint64 unique = 0; qint64 unique = 0;
qint64 count = 0; qint64 count = 0;
while (notAtEnd()) { while (notAtEnd()) {
@@ -565,10 +565,10 @@ void Parser::Private::parseErrorCounts()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("unique")) if (name == "unique")
unique = parseHex(blockingReadElementText(), QLatin1String("errorcounts/pair/unique")); unique = parseHex(blockingReadElementText(), "errorcounts/pair/unique");
else if (name == QLatin1String("count")) else if (name == "count")
count = parseInt64(blockingReadElementText(), QLatin1String("errorcounts/pair/count")); count = parseInt64(blockingReadElementText(), "errorcounts/pair/count");
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
} }
@@ -589,7 +589,7 @@ void Parser::Private::parseSuppressionCounts()
if (reader.isEndElement()) if (reader.isEndElement())
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
if (reader.name() == QLatin1String("pair")) { if (reader.name() == "pair") {
QString pairName; QString pairName;
qint64 count = 0; qint64 count = 0;
while (notAtEnd()) { while (notAtEnd()) {
@@ -598,10 +598,10 @@ void Parser::Private::parseSuppressionCounts()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("name")) if (name == "name")
pairName = blockingReadElementText(); pairName = blockingReadElementText();
else if (name == QLatin1String("count")) else if (name == "count")
count = parseInt64(blockingReadElementText(), QLatin1String("suppcounts/pair/count")); count = parseInt64(blockingReadElementText(), "suppcounts/pair/count");
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
} }
@@ -624,9 +624,9 @@ void Parser::Private::parseStatus()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("state")) if (name == "state")
s.setState(parseState(blockingReadElementText())); s.setState(parseState(blockingReadElementText()));
else if (name == QLatin1String("time")) else if (name == "time")
s.setTime(blockingReadElementText()); s.setTime(blockingReadElementText());
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
@@ -644,7 +644,7 @@ QVector<Frame> Parser::Private::parseStack()
if (reader.isEndElement()) if (reader.isEndElement())
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
if (reader.name() == QLatin1String("frame")) if (reader.name() == "frame")
frames.append(parseFrame()); frames.append(parseFrame());
} }
} }
@@ -662,9 +662,9 @@ SuppressionFrame Parser::Private::parseSuppressionFrame()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("obj")) if (name == "obj")
frame.setObject(blockingReadElementText()); frame.setObject(blockingReadElementText());
else if (name == QLatin1String("fun")) else if (name == "fun")
frame.setFunction( blockingReadElementText()); frame.setFunction( blockingReadElementText());
else if (reader.isStartElement()) else if (reader.isStartElement())
reader.skipCurrentElement(); reader.skipCurrentElement();
@@ -684,15 +684,15 @@ Suppression Parser::Private::parseSuppression()
break; break;
if (reader.isStartElement()) { if (reader.isStartElement()) {
const QStringRef name = reader.name(); const QStringRef name = reader.name();
if (name == QLatin1String("sname")) if (name == "sname")
supp.setName(blockingReadElementText()); supp.setName(blockingReadElementText());
else if (name == QLatin1String("skind")) else if (name == "skind")
supp.setKind(blockingReadElementText()); supp.setKind(blockingReadElementText());
else if (name == QLatin1String("skaux")) else if (name == "skaux")
supp.setAuxKind(blockingReadElementText()); supp.setAuxKind(blockingReadElementText());
else if (name == QLatin1String("rawtext")) else if (name == "rawtext")
supp.setRawText(blockingReadElementText()); supp.setRawText(blockingReadElementText());
else if (name == QLatin1String("sframe")) else if (name == "sframe")
frames.push_back(parseSuppressionFrame()); frames.push_back(parseSuppressionFrame());
} }
} }
@@ -710,19 +710,19 @@ void Parser::Private::parse(QIODevice *device)
while (notAtEnd()) { while (notAtEnd()) {
blockingReadNext(); blockingReadNext();
QStringRef name = reader.name(); QStringRef name = reader.name();
if (name == QLatin1String("error")) if (name == "error")
parseError(); parseError();
else if (name == QLatin1String("announcethread")) else if (name == "announcethread")
parseAnnounceThread(); parseAnnounceThread();
else if (name == QLatin1String("status")) else if (name == "status")
parseStatus(); parseStatus();
else if (name == QLatin1String("errorcounts")) else if (name == "errorcounts")
parseErrorCounts(); parseErrorCounts();
else if (name == QLatin1String("suppcounts")) else if (name == "suppcounts")
parseSuppressionCounts(); parseSuppressionCounts();
else if (name == QLatin1String("protocolversion")) else if (name == "protocolversion")
checkProtocolVersion(blockingReadElementText()); checkProtocolVersion(blockingReadElementText());
else if (name == QLatin1String("protocoltool")) else if (name == "protocoltool")
checkTool(blockingReadElementText()); checkTool(blockingReadElementText());
} }
} catch (const ParserException &e) { } catch (const ParserException &e) {

View File

@@ -102,9 +102,9 @@ void SuppressionFrame::setObject(const QString &obj)
QString SuppressionFrame::toString() const QString SuppressionFrame::toString() const
{ {
if (!d->fun.isEmpty()) if (!d->fun.isEmpty())
return QLatin1String("fun:") + d->fun; return "fun:" + d->fun;
else else
return QLatin1String("obj:") + d->obj; return "obj:" + d->obj;
} }
class Suppression::Private : public QSharedData class Suppression::Private : public QSharedData
@@ -222,7 +222,7 @@ QString Suppression::toString() const
{ {
QString ret; QString ret;
QTextStream stream(&ret); QTextStream stream(&ret);
const QLatin1String indent(" "); const QString indent(" ");
stream << "{\n"; stream << "{\n";
stream << indent << d->name << '\n'; stream << indent << d->name << '\n';