forked from qt-creator/qt-creator
Valgrind: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I935579630c4d2f3a7bce69756da9eceb5e2bc005 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -79,15 +79,15 @@ QString toOptionString(CallgrindController::Option option)
|
||||
|
||||
switch (option) {
|
||||
case CallgrindController::Dump:
|
||||
return "--dump";
|
||||
return QLatin1String("--dump");
|
||||
case CallgrindController::ResetEventCounters:
|
||||
return "--zero";
|
||||
return QLatin1String("--zero");
|
||||
case CallgrindController::Pause:
|
||||
return "--instr=off";
|
||||
return QLatin1String("--instr=off");
|
||||
case CallgrindController::UnPause:
|
||||
return "--instr=on";
|
||||
return QLatin1String("--instr=on");
|
||||
default:
|
||||
return ""; // never reached
|
||||
return QString(); // never reached
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ void CallgrindController::processError(QProcess::ProcessError)
|
||||
{
|
||||
QTC_ASSERT(m_process, return);
|
||||
const QString error = m_process->errorString();
|
||||
emit statusMessage(QString("An error occurred while trying to run %1: %2").arg(CALLGRIND_CONTROL_BINARY).arg(error));
|
||||
emit statusMessage(tr("An error occurred while trying to run %1: %2").arg(CALLGRIND_CONTROL_BINARY).arg(error));
|
||||
|
||||
m_process->deleteLater();
|
||||
m_process = 0;
|
||||
@@ -197,7 +197,7 @@ void CallgrindController::getLocalDataFile()
|
||||
QTC_ASSERT(m_valgrindProc, return);
|
||||
|
||||
// we look for callgrind.out.PID, but there may be updated ones called ~.PID.NUM
|
||||
QString baseFileName = QString("callgrind.out.%1").
|
||||
QString baseFileName = QString::fromLatin1("callgrind.out.%1").
|
||||
arg(m_valgrindProc->pid());
|
||||
const QString workingDir = m_valgrindProc->workingDirectory();
|
||||
// first, set the to-be-parsed file to callgrind.out.PID
|
||||
@@ -208,13 +208,13 @@ void CallgrindController::getLocalDataFile()
|
||||
emit statusMessage(tr("Downloading remote profile data..."));
|
||||
m_ssh = remote->connection();
|
||||
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
|
||||
QString cmd = QString("ls -t %1* | head -n 1").arg(fileName);
|
||||
QString cmd = QString::fromLatin1("ls -t %1* | head -n 1").arg(fileName);
|
||||
m_findRemoteFile = m_ssh->createRemoteProcess(cmd.toUtf8());
|
||||
connect(m_findRemoteFile.data(), SIGNAL(readyReadStandardOutput()), this,
|
||||
SLOT(foundRemoteFile()));
|
||||
m_findRemoteFile->start();
|
||||
} else {
|
||||
QDir dir(workingDir, QString("%1.*").arg(baseFileName), QDir::Time);
|
||||
QDir dir(workingDir, QString::fromLatin1("%1.*").arg(baseFileName), QDir::Time);
|
||||
QStringList outputFiles = dir.entryList();
|
||||
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
|
||||
if (!outputFiles.isEmpty())
|
||||
@@ -238,13 +238,13 @@ void CallgrindController::foundRemoteFile()
|
||||
void CallgrindController::sftpInitialized()
|
||||
{
|
||||
cleanupTempFile();
|
||||
QTemporaryFile dataFile(QDir::tempPath() + QDir::separator() + "callgrind.out.");
|
||||
QTemporaryFile dataFile(QDir::tempPath() + QDir::separator() + QLatin1String("callgrind.out."));
|
||||
QTC_ASSERT(dataFile.open(), return);
|
||||
m_tempDataFile = dataFile.fileName();
|
||||
dataFile.setAutoRemove(false);
|
||||
dataFile.close();
|
||||
|
||||
m_downloadJob = m_sftp->downloadFile(m_remoteFile, m_tempDataFile, QSsh::SftpOverwriteExisting);
|
||||
m_downloadJob = m_sftp->downloadFile(QString::fromLocal8Bit(m_remoteFile), m_tempDataFile, QSsh::SftpOverwriteExisting);
|
||||
}
|
||||
|
||||
void CallgrindController::sftpJobFinished(QSsh::SftpJobId job, const QString &error)
|
||||
|
||||
@@ -95,7 +95,7 @@ void CycleDetection::tarjan(Node *node)
|
||||
cycle->setFile(node->function->fileId());
|
||||
m_cycle++;
|
||||
qint64 id = -1;
|
||||
m_data->addCompressedFunction(QString("cycle %1").arg(m_cycle), id);
|
||||
m_data->addCompressedFunction(QString::fromLatin1("cycle %1").arg(m_cycle), id);
|
||||
cycle->setName(id);
|
||||
cycle->setObject(node->function->objectId());
|
||||
cycle->setFunctions(functions);
|
||||
|
||||
@@ -212,7 +212,7 @@ QModelIndex DataModel::indexForObject(const Function *function) const
|
||||
static QString noWrap(const QString &str)
|
||||
{
|
||||
QString escapedStr = str;
|
||||
return escapedStr.replace(QLatin1Char('-'), "‑");
|
||||
return escapedStr.replace(QLatin1Char('-'), QLatin1String("‑"));
|
||||
}
|
||||
|
||||
static QString shortenTemplate(QString str)
|
||||
|
||||
@@ -209,7 +209,7 @@ QString Function::location() const
|
||||
QString o = object();
|
||||
if (o.isEmpty())
|
||||
return QString();
|
||||
if (f.isEmpty() || f == "???")
|
||||
if (f.isEmpty() || f == QLatin1String("???"))
|
||||
return o;
|
||||
if (pos.isEmpty())
|
||||
return QCoreApplication::translate("Valgrind::Callgrind::Function", "%1 in %2").arg(f, o);
|
||||
|
||||
@@ -182,13 +182,13 @@ QString ParseData::prettyStringForEvent(const QString &event)
|
||||
QString type;
|
||||
if (event.contains(QLatin1Char('L')))
|
||||
type = ParseData::Private::tr("Last-level"); // first, "L" overwrites the others
|
||||
else if (event.at(0) == 'I')
|
||||
else if (event.at(0) == QLatin1Char('I'))
|
||||
type = ParseData::Private::tr("Instruction");
|
||||
else if (event.at(0) == 'D')
|
||||
else if (event.at(0) == QLatin1Char('D'))
|
||||
type = ParseData::Private::tr("Cache");
|
||||
else if (event.leftRef(2) == "Bc")
|
||||
else if (event.leftRef(2) == QLatin1String("Bc"))
|
||||
type = ParseData::Private::tr("Conditional branches");
|
||||
else if (event.leftRef(2) == "Bi")
|
||||
else if (event.leftRef(2) == QLatin1String("Bi"))
|
||||
type = ParseData::Private::tr("Indirect branches");
|
||||
|
||||
QStringList prettyString;
|
||||
@@ -198,7 +198,7 @@ QString ParseData::prettyStringForEvent(const QString &event)
|
||||
prettyString << ParseData::Private::tr("level %1").arg(event.at(1));
|
||||
prettyString << (isRead ? ParseData::Private::tr("read") : ParseData::Private::tr("write"));
|
||||
|
||||
if (event.at(0) == 'B')
|
||||
if (event.at(0) == QLatin1Char('B'))
|
||||
prettyString << (isMiss ? ParseData::Private::tr("mispredicted") : ParseData::Private::tr("executed"));
|
||||
else
|
||||
prettyString << (isMiss ? ParseData::Private::tr("miss") : ParseData::Private::tr("access"));
|
||||
@@ -221,9 +221,9 @@ void ParseData::setEvents(const QStringList &events)
|
||||
|
||||
QString ParseData::prettyStringForPosition(const QString &position)
|
||||
{
|
||||
if (position == "line")
|
||||
if (position == QLatin1String("line"))
|
||||
return ParseData::Private::tr("Line:"); // as in: "line number"
|
||||
else if (position == "instr")
|
||||
else if (position == QLatin1String("instr"))
|
||||
return ParseData::Private::tr("Instruction"); // as in: "instruction address"
|
||||
return ParseData::Private::tr("Position:"); // never reached, in theory
|
||||
}
|
||||
@@ -243,7 +243,7 @@ void ParseData::setPositions(const QStringList &positions)
|
||||
d->m_positions = positions;
|
||||
d->m_lineNumberPositionIndex = -1;
|
||||
for (int i = 0; i < positions.size(); ++i) {
|
||||
if (positions.at(i) == "line") {
|
||||
if (positions.at(i) == QLatin1String("line")) {
|
||||
d->m_lineNumberPositionIndex = i;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ CallgrindRunner::CallgrindRunner(QObject *parent)
|
||||
|
||||
QString CallgrindRunner::tool() const
|
||||
{
|
||||
return QString("callgrind");
|
||||
return QLatin1String("callgrind");
|
||||
}
|
||||
|
||||
Parser *CallgrindRunner::parser() const
|
||||
|
||||
@@ -68,19 +68,19 @@ QStringList CallgrindEngine::toolArguments() const
|
||||
QTC_ASSERT(callgrindSettings, return arguments);
|
||||
|
||||
if (callgrindSettings->enableCacheSim())
|
||||
arguments << "--cache-sim=yes";
|
||||
arguments << QLatin1String("--cache-sim=yes");
|
||||
|
||||
if (callgrindSettings->enableBranchSim())
|
||||
arguments << "--branch-sim=yes";
|
||||
arguments << QLatin1String("--branch-sim=yes");
|
||||
|
||||
if (callgrindSettings->collectBusEvents())
|
||||
arguments << "--collect-bus=yes";
|
||||
arguments << QLatin1String("--collect-bus=yes");
|
||||
|
||||
if (callgrindSettings->collectSystime())
|
||||
arguments << "--collect-systime=yes";
|
||||
arguments << QLatin1String("--collect-systime=yes");
|
||||
|
||||
if (m_markAsPaused)
|
||||
arguments << "--instr-atstart=no";
|
||||
arguments << QLatin1String("--instr-atstart=no");
|
||||
|
||||
// add extra arguments
|
||||
if (!m_argumentForToggleCollect.isEmpty())
|
||||
|
||||
@@ -67,7 +67,7 @@ QString CallgrindHelper::toPercent(float costs, const QLocale &locale)
|
||||
return locale.toString(costs, 'f', 1) + locale.percent();
|
||||
if (costs > 0.009f)
|
||||
return locale.toString(costs, 'f', 2) + locale.percent();
|
||||
return QString("<") + locale.toString(0.01f) + locale.percent();
|
||||
return QLatin1Char('<') + locale.toString(0.01f) + locale.percent();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -553,7 +553,7 @@ void CallgrindTool::extensionsInitialized()
|
||||
editorContextMenu->addSeparator(analyzerContext);
|
||||
|
||||
action = new QAction(tr("Profile Costs of this Function and its Callees"), this);
|
||||
action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON));
|
||||
action->setIcon(QIcon(QLatin1String(Analyzer::Constants::ANALYZER_CONTROL_START_ICON)));
|
||||
connect(action, SIGNAL(triggered()), d, SLOT(handleShowCostsOfFunction()));
|
||||
cmd = Core::ActionManager::registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction",
|
||||
analyzerContext);
|
||||
@@ -631,13 +631,13 @@ QWidget *CallgrindToolPrivate::createWidgets()
|
||||
Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow();
|
||||
m_visualisation = new Visualisation(mw);
|
||||
m_visualisation->setFrameStyle(QFrame::NoFrame);
|
||||
m_visualisation->setObjectName("Valgrind.CallgrindTool.Visualisation");
|
||||
m_visualisation->setObjectName(QLatin1String("Valgrind.CallgrindTool.Visualisation"));
|
||||
m_visualisation->setModel(m_dataModel);
|
||||
connect(m_visualisation, SIGNAL(functionActivated(const Valgrind::Callgrind::Function*)),
|
||||
this, SLOT(visualisationFunctionSelected(const Valgrind::Callgrind::Function*)));
|
||||
|
||||
m_callersView = new CostView(mw);
|
||||
m_callersView->setObjectName("Valgrind.CallgrindTool.CallersView");
|
||||
m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView"));
|
||||
m_callersView->sortByColumn(CallModel::CostColumn);
|
||||
m_callersView->setFrameStyle(QFrame::NoFrame);
|
||||
// enable sorting
|
||||
@@ -649,7 +649,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
|
||||
this, SLOT(callerFunctionSelected(QModelIndex)));
|
||||
|
||||
m_calleesView = new CostView(mw);
|
||||
m_calleesView->setObjectName("Valgrind.CallgrindTool.CalleesView");
|
||||
m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView"));
|
||||
m_calleesView->sortByColumn(CallModel::CostColumn);
|
||||
m_calleesView->setFrameStyle(QFrame::NoFrame);
|
||||
// enable sorting
|
||||
@@ -661,7 +661,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
|
||||
this, SLOT(calleeFunctionSelected(QModelIndex)));
|
||||
|
||||
m_flatView = new CostView(mw);
|
||||
m_flatView->setObjectName("Valgrind.CallgrindTool.FlatView");
|
||||
m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView"));
|
||||
m_flatView->sortByColumn(DataModel::SelfCostColumn);
|
||||
m_flatView->setFrameStyle(QFrame::NoFrame);
|
||||
m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
@@ -821,7 +821,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
|
||||
|
||||
// filtering
|
||||
action = new QAction(tr("Show Project Costs Only"), this);
|
||||
action->setIcon(QIcon(Core::Constants::ICON_FILTER));
|
||||
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER)));
|
||||
action->setToolTip(tr("Show only profiling info that originated from this project source."));
|
||||
action->setCheckable(true);
|
||||
connect(action, SIGNAL(toggled(bool)), this, SLOT(handleFilterProjectCosts()));
|
||||
@@ -883,7 +883,7 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data)
|
||||
if (data->events().isEmpty()) {
|
||||
msg = tr("Parsing finished, no data.");
|
||||
} else {
|
||||
const QString costStr = QString("%1 %2").arg(QString::number(data->totalCost(0)), data->events().first());
|
||||
const QString costStr = QString::fromLatin1("%1 %2").arg(QString::number(data->totalCost(0)), data->events().first());
|
||||
msg = tr("Parsing finished, total cost of %1 reported.").arg(costStr);
|
||||
}
|
||||
} else {
|
||||
@@ -985,7 +985,7 @@ void CallgrindToolPrivate::createTextMarks()
|
||||
const QModelIndex index = model->index(row, DataModel::InclusiveCostColumn);
|
||||
|
||||
QString fileName = index.data(DataModel::FileNameRole).toString();
|
||||
if (fileName.isEmpty() || fileName == "???")
|
||||
if (fileName.isEmpty() || fileName == QLatin1String("???"))
|
||||
continue;
|
||||
|
||||
bool ok = false;
|
||||
@@ -1000,7 +1000,7 @@ void CallgrindToolPrivate::createTextMarks()
|
||||
continue; // isEmpty == true => file does not exist, continue then
|
||||
|
||||
// create only one text mark per location
|
||||
const QString location = QString("%1:%2").arg(fileName, QString::number(lineNumber));
|
||||
const QString location = QString::fromLatin1("%1:%2").arg(fileName, QString::number(lineNumber));
|
||||
if (locations.contains(location))
|
||||
continue;
|
||||
locations << location;
|
||||
|
||||
@@ -228,7 +228,7 @@ Visualisation::Private::Private(Visualisation *qq)
|
||||
, m_model(new DataProxyModel(qq))
|
||||
{
|
||||
// setup scene
|
||||
m_scene.setObjectName("Visualisation Scene");
|
||||
m_scene.setObjectName(QLatin1String("Visualisation Scene"));
|
||||
///NOTE: with size 100x100 the Qt-internal mouse selection fails...
|
||||
m_scene.setSceneRect(0, 0, 1024, 1024);
|
||||
|
||||
@@ -283,7 +283,7 @@ Visualisation::Visualisation(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
, d(new Private(this))
|
||||
{
|
||||
setObjectName("Visualisation View");
|
||||
setObjectName(QLatin1String("Visualisation View"));
|
||||
setScene(&d->m_scene);
|
||||
setRenderHint(QPainter::Antialiasing);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ MemcheckRunner::~MemcheckRunner()
|
||||
|
||||
QString MemcheckRunner::tool() const
|
||||
{
|
||||
return QString("memcheck");
|
||||
return QLatin1String("memcheck");
|
||||
}
|
||||
|
||||
void MemcheckRunner::setParser(XmlProtocol::ThreadedParser *parser)
|
||||
@@ -110,10 +110,10 @@ bool MemcheckRunner::start()
|
||||
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
|
||||
|
||||
QStringList memcheckArguments;
|
||||
memcheckArguments << QString("--xml=yes")
|
||||
<< QString("--xml-socket=127.0.0.1:%1").arg(QString::number(xmlPortNumber))
|
||||
<< QString("--child-silent-after-fork=yes")
|
||||
<< QString("--log-socket=127.0.0.1:%1").arg(QString::number(logPortNumber))
|
||||
memcheckArguments << QLatin1String("--xml=yes")
|
||||
<< QString::fromLatin1("--xml-socket=127.0.0.1:%1").arg(xmlPortNumber)
|
||||
<< QLatin1String("--child-silent-after-fork=yes")
|
||||
<< QString::fromLatin1("--log-socket=127.0.0.1:%1").arg(logPortNumber)
|
||||
<< valgrindArguments();
|
||||
setValgrindArguments(memcheckArguments);
|
||||
}
|
||||
@@ -139,10 +139,10 @@ bool MemcheckRunner::start()
|
||||
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
|
||||
|
||||
QStringList memcheckArguments;
|
||||
memcheckArguments << QString("--xml=yes")
|
||||
<< QString("--xml-socket=%1:%2").arg(ip, QString::number(xmlPortNumber))
|
||||
<< QString("--child-silent-after-fork=yes")
|
||||
<< QString("--log-socket=%1:%2").arg(ip, QString::number(logPortNumber));
|
||||
memcheckArguments << QLatin1String("--xml=yes")
|
||||
<< QString::fromLatin1("--xml-socket=%1:%2").arg(ip).arg(xmlPortNumber)
|
||||
<< QLatin1String("--child-silent-after-fork=yes")
|
||||
<< QString::fromLatin1("--log-socket=%1:%2").arg(ip).arg(logPortNumber);
|
||||
setValgrindArguments(memcheckArguments);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,9 +99,9 @@ QStringList MemcheckEngine::toolArguments() const
|
||||
arguments << QLatin1String("--track-origins=yes");
|
||||
|
||||
foreach (const QString &file, memcheckSettings->suppressionFiles())
|
||||
arguments << QString("--suppressions=%1").arg(file);
|
||||
arguments << QString::fromLatin1("--suppressions=%1").arg(file);
|
||||
|
||||
arguments << QString("--num-callers=%1").arg(memcheckSettings->numCallers());
|
||||
arguments << QString::fromLatin1("--num-callers=%1").arg(memcheckSettings->numCallers());
|
||||
return arguments;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void MemcheckEngine::receiveLogMessage(const QByteArray &b)
|
||||
{
|
||||
QString error = QString::fromLocal8Bit(b);
|
||||
// workaround https://bugs.kde.org/show_bug.cgi?id=255888
|
||||
error.remove(QRegExp("==*== </valgrindoutput>", Qt::CaseSensitive, QRegExp::Wildcard));
|
||||
error.remove(QRegExp(QLatin1String("==*== </valgrindoutput>"), Qt::CaseSensitive, QRegExp::Wildcard));
|
||||
|
||||
error = error.trimmed();
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo,
|
||||
|
||||
if (link && !f.isEmpty() && QFile::exists(fullPath)) {
|
||||
// make a hyperlink label
|
||||
path = QString("<a href=\"file://%1:%2\" %4>%3</a>")
|
||||
path = QString::fromLatin1("<a href=\"file://%1:%2\" %4>%3</a>")
|
||||
.arg(fullPath, QString::number(frame.line()), path, linkAttr);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ static QString makeFrameName(const Frame &frame, const QString &relativeTo,
|
||||
return QCoreApplication::translate("Valgrind::Internal", "%1 in %2").arg(Qt::escape(fn), path);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
return QString("0x%1").arg(frame.instructionPointer(), 0, 16);
|
||||
return QString::fromLatin1("0x%1").arg(frame.instructionPointer(), 0, 16);
|
||||
}
|
||||
|
||||
static QString relativeToPath()
|
||||
@@ -216,7 +216,7 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorInde
|
||||
// code + white-space:pre so the padding (see below) works properly
|
||||
// don't include frameName here as it should wrap if required and pre-line is not supported
|
||||
// by Qt yet it seems
|
||||
const QString displayTextTemplate = QString("<code style='white-space:pre'>%1:</code> %2");
|
||||
const QString displayTextTemplate = QString::fromLatin1("<code style='white-space:pre'>%1:</code> %2");
|
||||
const QString relativeTo = relativeToPath();
|
||||
const Error error = errorIndex.data(ErrorListModel::ErrorRole).value<Error>();
|
||||
|
||||
@@ -227,11 +227,11 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorInde
|
||||
errorLabel->setIndent(0);
|
||||
QPalette p = errorLabel->palette();
|
||||
QColor lc = p.color(QPalette::Text);
|
||||
QString linkStyle = QString("style=\"color:rgba(%1, %2, %3, %4);\"")
|
||||
QString linkStyle = QString::fromLatin1("style=\"color:rgba(%1, %2, %3, %4);\"")
|
||||
.arg(lc.red()).arg(lc.green()).arg(lc.blue()).arg(int(0.7 * 255));
|
||||
p.setBrush(QPalette::Text, p.highlightedText());
|
||||
errorLabel->setPalette(p);
|
||||
errorLabel->setText(QString("%1 <span %4>%2</span>")
|
||||
errorLabel->setText(QString::fromLatin1("%1 <span %4>%2</span>")
|
||||
.arg(error.what(), errorLocation(errorIndex, error, true, linkStyle),
|
||||
linkStyle));
|
||||
connect(errorLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
|
||||
@@ -265,7 +265,7 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorInde
|
||||
p.setBrush(QPalette::Base, p.alternateBase());
|
||||
frameLabel->setPalette(p);
|
||||
}
|
||||
frameLabel->setFont(QFont("monospace"));
|
||||
frameLabel->setFont(QFont(QLatin1String("monospace")));
|
||||
connect(frameLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
|
||||
// pad frameNr to 2 chars since only 50 frames max are supported by valgrind
|
||||
const QString displayText = displayTextTemplate
|
||||
@@ -343,7 +343,7 @@ void MemcheckErrorDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
||||
const int widthLeft = opt.rect.width() - (pos.x() + whatWidth + space + s_itemMargin);
|
||||
if (widthLeft > 0) {
|
||||
QFont monospace = opt.font;
|
||||
monospace.setFamily("monospace");
|
||||
monospace.setFamily(QLatin1String("monospace"));
|
||||
QFontMetrics metrics(monospace);
|
||||
QColor nameColor = textColor;
|
||||
nameColor.setAlphaF(0.7);
|
||||
@@ -430,7 +430,7 @@ void MemcheckErrorDelegate::copy()
|
||||
void MemcheckErrorDelegate::openLinkInEditor(const QString &link)
|
||||
{
|
||||
const int pathStart = strlen("file://");
|
||||
const int pathEnd = link.lastIndexOf(':');
|
||||
const int pathEnd = link.lastIndexOf(QLatin1Char(':'));
|
||||
const QString path = link.mid(pathStart, pathEnd - pathStart);
|
||||
const int line = link.mid(pathEnd + 1).toInt(0);
|
||||
TextEditor::BaseTextEditorWidget::openEditorAt(path, qMax(line, 0));
|
||||
@@ -445,7 +445,7 @@ MemcheckErrorView::MemcheckErrorView(QWidget *parent)
|
||||
|
||||
m_copyAction = new QAction(this);
|
||||
m_copyAction->setText(tr("Copy Selection"));
|
||||
m_copyAction->setIcon(QIcon(Core::Constants::ICON_COPY));
|
||||
m_copyAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_COPY)));
|
||||
m_copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
m_copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
connect(m_copyAction, SIGNAL(triggered()), itemDelegate(), SLOT(copy()));
|
||||
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
//if no frame belonging to the project was found, return the first one that is not malloc/new
|
||||
foreach (const Frame &frame, frames) {
|
||||
if (!frame.functionName().isEmpty() && frame.functionName() != QLatin1String("malloc")
|
||||
&& !frame.functionName().startsWith("operator new(") )
|
||||
&& !frame.functionName().startsWith(QLatin1String("operator new(")))
|
||||
{
|
||||
return frame;
|
||||
}
|
||||
@@ -386,7 +386,7 @@ QWidget *MemcheckTool::createWidgets()
|
||||
m_errorView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_errorView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
m_errorView->setAutoScroll(false);
|
||||
m_errorView->setObjectName("Valgrind.MemcheckTool.ErrorView");
|
||||
m_errorView->setObjectName(QLatin1String("Valgrind.MemcheckTool.ErrorView"));
|
||||
|
||||
QDockWidget *errorDock = AnalyzerManager::createDockWidget
|
||||
(this, tr("Memory Issues"), m_errorView, Qt::BottomDockWidgetArea);
|
||||
@@ -429,7 +429,7 @@ QWidget *MemcheckTool::createWidgets()
|
||||
m_goNext = action;
|
||||
|
||||
QToolButton *filterButton = new QToolButton;
|
||||
filterButton->setIcon(QIcon(Core::Constants::ICON_FILTER));
|
||||
filterButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER)));
|
||||
filterButton->setText(tr("Error Filter"));
|
||||
filterButton->setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ static QString suppressionText(const Error &error)
|
||||
newName = frame.object();
|
||||
|
||||
if (!newName.isEmpty())
|
||||
sup.setName(newName + '[' + sup.kind() + ']');
|
||||
sup.setName(newName + QLatin1Char('[') + sup.kind() + QLatin1Char(']'));
|
||||
}
|
||||
|
||||
return sup.toString();
|
||||
|
||||
@@ -12,6 +12,8 @@ CONFIG += exceptions
|
||||
|
||||
INCLUDEPATH *= $$PWD
|
||||
|
||||
DEFINES += QT_NO_CAST_FROM_ASCII
|
||||
|
||||
HEADERS += \
|
||||
valgrindplugin.h \
|
||||
valgrindengine.h \
|
||||
|
||||
@@ -5,6 +5,7 @@ import "../QtcPlugin.qbs" as QtcPlugin
|
||||
QtcPlugin {
|
||||
name: "Valgrind"
|
||||
|
||||
Depends { name: "cpp" }
|
||||
Depends { name: "Qt"; submodules: ["widgets", "network"] }
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "AnalyzerBase" }
|
||||
@@ -12,6 +13,7 @@ QtcPlugin {
|
||||
Depends { name: "TextEditor" }
|
||||
Depends { name: "RemoteLinux" }
|
||||
Depends { name: "CPlusPlus"}
|
||||
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
|
||||
|
||||
files: [
|
||||
"callgrindcostdelegate.cpp",
|
||||
|
||||
@@ -80,7 +80,7 @@ bool ValgrindEngine::start()
|
||||
emit starting(this);
|
||||
|
||||
Core::FutureProgress *fp = Core::ICore::progressManager()->addTask(m_progress->future(),
|
||||
progressTitle(), "valgrind");
|
||||
progressTitle(), QLatin1String("valgrind"));
|
||||
fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish);
|
||||
m_progress->setProgressRange(0, progressMaximum);
|
||||
m_progress->reportStarted();
|
||||
@@ -97,7 +97,7 @@ bool ValgrindEngine::start()
|
||||
runner()->setWorkingDirectory(sp.workingDirectory);
|
||||
QString valgrindExe = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
||||
if (!sp.analyzerCmdPrefix.isEmpty())
|
||||
valgrindExe = sp.analyzerCmdPrefix + ' ' + valgrindExe;
|
||||
valgrindExe = sp.analyzerCmdPrefix + QLatin1Char(' ') + valgrindExe;
|
||||
runner()->setValgrindExecutable(valgrindExe);
|
||||
runner()->setValgrindArguments(toolArguments());
|
||||
runner()->setDebuggeeExecutable(sp.debuggee);
|
||||
@@ -179,7 +179,7 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process
|
||||
} else if (m_isStopping && e == QProcess::Crashed) { // process gets killed on stop
|
||||
emit outputReceived(tr("** Process Terminated **\n"), Utils::ErrorMessageFormat);
|
||||
} else {
|
||||
emit outputReceived(QString("** %1 **\n").arg(error), Utils::ErrorMessageFormat);
|
||||
emit outputReceived(QString::fromLatin1("** %1 **\n").arg(error), Utils::ErrorMessageFormat);
|
||||
}
|
||||
|
||||
if (m_isStopping)
|
||||
|
||||
@@ -201,13 +201,13 @@ void RemoteValgrindProcess::connected()
|
||||
QString cmd;
|
||||
|
||||
if (!m_workingDir.isEmpty())
|
||||
cmd += QString("cd '%1' && ").arg(m_workingDir);
|
||||
cmd += QString::fromLatin1("cd '%1' && ").arg(m_workingDir);
|
||||
|
||||
QString arguments;
|
||||
Utils::QtcProcess::addArgs(&arguments, m_valgrindArgs);
|
||||
Utils::QtcProcess::addArg(&arguments, m_debuggee);
|
||||
Utils::QtcProcess::addArgs(&arguments, m_debuggeeArgs);
|
||||
cmd += m_valgrindExe + ' ' + arguments;
|
||||
cmd += m_valgrindExe + QLatin1Char(' ') + arguments;
|
||||
|
||||
m_process = m_connection->createRemoteProcess(cmd.toUtf8());
|
||||
connect(m_process.data(), SIGNAL(readyReadStandardError()), this, SLOT(standardError()));
|
||||
@@ -240,12 +240,12 @@ void RemoteValgrindProcess::processStarted()
|
||||
const QString proc = m_valgrindExe.split(QLatin1Char(' ')).last();
|
||||
// sleep required since otherwise we might only match "bash -c..."
|
||||
// and not the actual valgrind run
|
||||
const QString cmd = QString("sleep 1; ps ax" // list all processes with aliased name
|
||||
" | grep '\\b%1.*%2'" // find valgrind process
|
||||
" | tail -n 1" // limit to single process
|
||||
// we pick the last one, first would be "bash -c ..."
|
||||
" | awk '{print $1;}'" // get pid
|
||||
).arg(proc, QFileInfo(m_debuggee).fileName());
|
||||
const QString cmd = QString::fromLatin1("sleep 1; ps ax" // list all processes with aliased name
|
||||
" | grep '\\b%1.*%2'" // find valgrind process
|
||||
" | tail -n 1" // limit to single process
|
||||
// we pick the last one, first would be "bash -c ..."
|
||||
" | awk '{print $1;}'" // get pid
|
||||
).arg(proc, QFileInfo(m_debuggee).fileName());
|
||||
|
||||
m_findPID = m_connection->createRemoteProcess(cmd.toUtf8());
|
||||
connect(m_findPID.data(), SIGNAL(readyReadStandardError()), this, SLOT(standardError()));
|
||||
@@ -297,11 +297,11 @@ void RemoteValgrindProcess::close()
|
||||
QTC_ASSERT(m_connection->state() == QSsh::SshConnection::Connected, return);
|
||||
if (m_process) {
|
||||
if (m_pid) {
|
||||
const QString killTemplate = QString("kill -%2 %1" // kill
|
||||
const QString killTemplate = QString::fromLatin1("kill -%2 %1" // kill
|
||||
).arg(m_pid);
|
||||
|
||||
const QString niceKill = killTemplate.arg("SIGTERM");
|
||||
const QString brutalKill = killTemplate.arg("SIGKILL");
|
||||
const QString niceKill = killTemplate.arg(QLatin1String("SIGTERM"));
|
||||
const QString brutalKill = killTemplate.arg(QLatin1String("SIGKILL"));
|
||||
const QString remoteCall = niceKill + QLatin1String("; sleep 1; ") + brutalKill;
|
||||
|
||||
QSsh::SshRemoteProcess::Ptr cleanup = m_connection->createRemoteProcess(remoteCall.toUtf8());
|
||||
|
||||
@@ -90,7 +90,7 @@ void ValgrindRunner::Private::run(ValgrindProcess *_process)
|
||||
// consider appending our options last so they override any interfering user-supplied options
|
||||
// -q as suggested by valgrind manual
|
||||
QStringList valgrindArgs = valgrindArguments;
|
||||
valgrindArgs << QString("--tool=%1").arg(q->tool());
|
||||
valgrindArgs << QString::fromLatin1("--tool=%1").arg(q->tool());
|
||||
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
// May be slower to start but without it we get no filenames for symbols.
|
||||
|
||||
@@ -174,7 +174,7 @@ QString ValgrindBaseSettings::valgrindExecutable() const
|
||||
|
||||
QString ValgrindBaseSettings::id() const
|
||||
{
|
||||
return "Analyzer.Valgrind.Settings";
|
||||
return QLatin1String("Analyzer.Valgrind.Settings");
|
||||
}
|
||||
|
||||
QString ValgrindBaseSettings::displayName() const
|
||||
@@ -296,9 +296,9 @@ QVariantMap ValgrindGlobalSettings::defaults() const
|
||||
QVariantMap map = ValgrindBaseSettings::defaults();
|
||||
|
||||
// Memcheck
|
||||
map.insert(suppressionFilesC, QStringList());
|
||||
map.insert(lastSuppressionDirectoryC, QString());
|
||||
map.insert(lastSuppressionHistoryC, QStringList());
|
||||
map.insert(QLatin1String(suppressionFilesC), QStringList());
|
||||
map.insert(QLatin1String(lastSuppressionDirectoryC), QString());
|
||||
map.insert(QLatin1String(lastSuppressionHistoryC), QStringList());
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindCostFormatC), CostDelegate::FormatRelative);
|
||||
@@ -312,9 +312,9 @@ void ValgrindGlobalSettings::fromMap(const QVariantMap &map)
|
||||
ValgrindBaseSettings::fromMap(map);
|
||||
|
||||
// Memcheck
|
||||
m_suppressionFiles = map.value(suppressionFilesC).toStringList();
|
||||
m_lastSuppressionDirectory = map.value(lastSuppressionDirectoryC).toString();
|
||||
m_lastSuppressionHistory = map.value(lastSuppressionHistoryC).toStringList();
|
||||
m_suppressionFiles = map.value(QLatin1String(suppressionFilesC)).toStringList();
|
||||
m_lastSuppressionDirectory = map.value(QLatin1String(lastSuppressionDirectoryC)).toString();
|
||||
m_lastSuppressionHistory = map.value(QLatin1String(lastSuppressionHistoryC)).toStringList();
|
||||
|
||||
// Callgrind
|
||||
// special code as the default one does not cope with the enum properly
|
||||
@@ -336,9 +336,9 @@ QVariantMap ValgrindGlobalSettings::toMap() const
|
||||
QVariantMap map = ValgrindBaseSettings::toMap();
|
||||
|
||||
// Memcheck
|
||||
map.insert(suppressionFilesC, m_suppressionFiles);
|
||||
map.insert(lastSuppressionDirectoryC, m_lastSuppressionDirectory);
|
||||
map.insert(lastSuppressionHistoryC, m_lastSuppressionHistory);
|
||||
map.insert(QLatin1String(suppressionFilesC), m_suppressionFiles);
|
||||
map.insert(QLatin1String(lastSuppressionDirectoryC), m_lastSuppressionDirectory);
|
||||
map.insert(QLatin1String(lastSuppressionHistoryC), m_lastSuppressionHistory);
|
||||
|
||||
// Callgrind
|
||||
map.insert(QLatin1String(callgrindCostFormatC), m_costFormat);
|
||||
@@ -449,8 +449,8 @@ QVariantMap ValgrindProjectSettings::defaults() const
|
||||
QVariantMap map = ValgrindBaseSettings::defaults();
|
||||
|
||||
// Memcheck
|
||||
map.insert(addedSuppressionFilesC, QStringList());
|
||||
map.insert(removedSuppressionFilesC, QStringList());
|
||||
map.insert(QLatin1String(addedSuppressionFilesC), QStringList());
|
||||
map.insert(QLatin1String(removedSuppressionFilesC), QStringList());
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -460,8 +460,8 @@ void ValgrindProjectSettings::fromMap(const QVariantMap &map)
|
||||
ValgrindBaseSettings::fromMap(map);
|
||||
|
||||
// Memcheck
|
||||
setIfPresent(map, addedSuppressionFilesC, &m_addedSuppressionFiles);
|
||||
setIfPresent(map, removedSuppressionFilesC, &m_disabledGlobalSuppressionFiles);
|
||||
setIfPresent(map, QLatin1String(addedSuppressionFilesC), &m_addedSuppressionFiles);
|
||||
setIfPresent(map, QLatin1String(removedSuppressionFilesC), &m_disabledGlobalSuppressionFiles);
|
||||
}
|
||||
|
||||
AbstractAnalyzerSubConfig *ValgrindProjectSettings::clone()
|
||||
@@ -476,8 +476,8 @@ QVariantMap ValgrindProjectSettings::toMap() const
|
||||
QVariantMap map = ValgrindBaseSettings::toMap();
|
||||
|
||||
// Memcheck
|
||||
map.insert(addedSuppressionFilesC, m_addedSuppressionFiles);
|
||||
map.insert(removedSuppressionFilesC, m_disabledGlobalSuppressionFiles);
|
||||
map.insert(QLatin1String(addedSuppressionFilesC), m_addedSuppressionFiles);
|
||||
map.insert(QLatin1String(removedSuppressionFilesC), m_disabledGlobalSuppressionFiles);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ QString toolTipForFrame(const Frame &frame)
|
||||
if (!frame.file().isEmpty()) {
|
||||
location = frame.directory() + QDir::separator() + frame.file();
|
||||
if (frame.line() > 0)
|
||||
location += ':' + QString::number(frame.line());
|
||||
location += QLatin1Char(':') + QString::number(frame.line());
|
||||
}
|
||||
|
||||
typedef QPair<QString, QString> StringPair;
|
||||
@@ -64,10 +64,10 @@ QString toolTipForFrame(const Frame &frame)
|
||||
if (!frame.object().isEmpty())
|
||||
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());
|
||||
|
||||
QString html = "<html>"
|
||||
QString html = QLatin1String("<html>"
|
||||
"<head>"
|
||||
"<style>dt { font-weight:bold; } dd { font-family: monospace; }</style>\n"
|
||||
"<body><dl>";
|
||||
"<body><dl>");
|
||||
|
||||
foreach (const StringPair &pair, lines) {
|
||||
html += QLatin1String("<dt>");
|
||||
@@ -76,7 +76,7 @@ QString toolTipForFrame(const Frame &frame)
|
||||
html += pair.second;
|
||||
html += QLatin1String("</dd>\n");
|
||||
}
|
||||
html += "</dl></body></html>";
|
||||
html += QLatin1String("</dl></body></html>");
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user