diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2012-11-26 15:02:17 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-11-27 09:06:15 +0100 |
commit | dba973c9331a5ba6c4d534d2a4876e683a6db39e (patch) | |
tree | e69f66c24d3aac505ef9a1e4003bff7c8f605ced | |
parent | 6cae330ec771b44165ac14a71707b68e408d57a8 (diff) | |
download | qt-creator-dba973c9331a5ba6c4d534d2a4876e683a6db39e.tar.gz |
Valgrind: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I935579630c4d2f3a7bce69756da9eceb5e2bc005
Reviewed-by: hjk <qthjk@ovi.com>
25 files changed, 195 insertions, 191 deletions
diff --git a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp index 1d2f9b0e46..b9e1b59c82 100644 --- a/src/plugins/valgrind/callgrind/callgrindcontroller.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcontroller.cpp @@ -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) diff --git a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp index ce88d5e17c..939c701a39 100644 --- a/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp +++ b/src/plugins/valgrind/callgrind/callgrindcycledetection.cpp @@ -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); diff --git a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp index 20df7fda22..b9a0979ee8 100644 --- a/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp +++ b/src/plugins/valgrind/callgrind/callgrinddatamodel.cpp @@ -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) diff --git a/src/plugins/valgrind/callgrind/callgrindfunction.cpp b/src/plugins/valgrind/callgrind/callgrindfunction.cpp index 3164ec5cf2..e91610d71a 100644 --- a/src/plugins/valgrind/callgrind/callgrindfunction.cpp +++ b/src/plugins/valgrind/callgrind/callgrindfunction.cpp @@ -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); diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp index b7cef3ac07..c8db1fe1f7 100644 --- a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp @@ -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; } diff --git a/src/plugins/valgrind/callgrind/callgrindrunner.cpp b/src/plugins/valgrind/callgrind/callgrindrunner.cpp index 6b9c59ca25..642cd96565 100644 --- a/src/plugins/valgrind/callgrind/callgrindrunner.cpp +++ b/src/plugins/valgrind/callgrind/callgrindrunner.cpp @@ -54,7 +54,7 @@ CallgrindRunner::CallgrindRunner(QObject *parent) QString CallgrindRunner::tool() const { - return QString("callgrind"); + return QLatin1String("callgrind"); } Parser *CallgrindRunner::parser() const diff --git a/src/plugins/valgrind/callgrindengine.cpp b/src/plugins/valgrind/callgrindengine.cpp index 7ebf045226..ab9e7da04e 100644 --- a/src/plugins/valgrind/callgrindengine.cpp +++ b/src/plugins/valgrind/callgrindengine.cpp @@ -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()) diff --git a/src/plugins/valgrind/callgrindhelper.cpp b/src/plugins/valgrind/callgrindhelper.cpp index dd222f0fa1..9a763f6c7b 100644 --- a/src/plugins/valgrind/callgrindhelper.cpp +++ b/src/plugins/valgrind/callgrindhelper.cpp @@ -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 diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 03cfd63904..09c2c4f252 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -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; diff --git a/src/plugins/valgrind/callgrindvisualisation.cpp b/src/plugins/valgrind/callgrindvisualisation.cpp index ab51a87e99..ffdbaf3579 100644 --- a/src/plugins/valgrind/callgrindvisualisation.cpp +++ b/src/plugins/valgrind/callgrindvisualisation.cpp @@ -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); } diff --git a/src/plugins/valgrind/memcheck/memcheckrunner.cpp b/src/plugins/valgrind/memcheck/memcheckrunner.cpp index 48393113c9..16a06590db 100644 --- a/src/plugins/valgrind/memcheck/memcheckrunner.cpp +++ b/src/plugins/valgrind/memcheck/memcheckrunner.cpp @@ -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); } diff --git a/src/plugins/valgrind/memcheckengine.cpp b/src/plugins/valgrind/memcheckengine.cpp index a74d1b63ce..035995734a 100644 --- a/src/plugins/valgrind/memcheckengine.cpp +++ b/src/plugins/valgrind/memcheckengine.cpp @@ -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(); diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index d82c26baa6..212afe30bc 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -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())); diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 1b26e02a45..0e034948d1 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -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); diff --git a/src/plugins/valgrind/suppressiondialog.cpp b/src/plugins/valgrind/suppressiondialog.cpp index 5f55680384..308a353ab6 100644 --- a/src/plugins/valgrind/suppressiondialog.cpp +++ b/src/plugins/valgrind/suppressiondialog.cpp @@ -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(); diff --git a/src/plugins/valgrind/valgrind.pro b/src/plugins/valgrind/valgrind.pro index 95d5ec7f85..2e8566a178 100644 --- a/src/plugins/valgrind/valgrind.pro +++ b/src/plugins/valgrind/valgrind.pro @@ -12,6 +12,8 @@ CONFIG += exceptions INCLUDEPATH *= $$PWD +DEFINES += QT_NO_CAST_FROM_ASCII + HEADERS += \ valgrindplugin.h \ valgrindengine.h \ diff --git a/src/plugins/valgrind/valgrind.qbs b/src/plugins/valgrind/valgrind.qbs index e3add86457..d8f91c58f5 100644 --- a/src/plugins/valgrind/valgrind.qbs +++ b/src/plugins/valgrind/valgrind.qbs @@ -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", diff --git a/src/plugins/valgrind/valgrindengine.cpp b/src/plugins/valgrind/valgrindengine.cpp index 4f89549d9d..77e5fd2e60 100644 --- a/src/plugins/valgrind/valgrindengine.cpp +++ b/src/plugins/valgrind/valgrindengine.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) diff --git a/src/plugins/valgrind/valgrindprocess.cpp b/src/plugins/valgrind/valgrindprocess.cpp index 963911ad31..8a7524127b 100644 --- a/src/plugins/valgrind/valgrindprocess.cpp +++ b/src/plugins/valgrind/valgrindprocess.cpp @@ -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()); diff --git a/src/plugins/valgrind/valgrindrunner.cpp b/src/plugins/valgrind/valgrindrunner.cpp index 71d38699ed..4d8a155cdc 100644 --- a/src/plugins/valgrind/valgrindrunner.cpp +++ b/src/plugins/valgrind/valgrindrunner.cpp @@ -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. diff --git a/src/plugins/valgrind/valgrindsettings.cpp b/src/plugins/valgrind/valgrindsettings.cpp index ca417a48a3..97acb9bd22 100644 --- a/src/plugins/valgrind/valgrindsettings.cpp +++ b/src/plugins/valgrind/valgrindsettings.cpp @@ -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; } diff --git a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp index a7fc21211a..8d6350f914 100644 --- a/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp +++ b/src/plugins/valgrind/xmlprotocol/modelhelpers.cpp @@ -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; } diff --git a/tests/valgrind/callgrind/callgrindparsertests.cpp b/tests/valgrind/callgrind/callgrindparsertests.cpp index cbd3bf9e82..4cb115ed4a 100644 --- a/tests/valgrind/callgrind/callgrindparsertests.cpp +++ b/tests/valgrind/callgrind/callgrindparsertests.cpp @@ -121,8 +121,8 @@ void CallgrindParserTests::testHeaderData() { QScopedPointer<const ParseData> data(parseDataFile(dataFile("simpleFunction.out"))); - QCOMPARE(data->command(), QString("ls")); - QCOMPARE(data->creator(), QString("callgrind-3.6.0.SVN-Debian")); + QCOMPARE(data->command(), QLatin1String("ls")); + QCOMPARE(data->creator(), QLatin1String("callgrind-3.6.0.SVN-Debian")); QCOMPARE(data->pid(), quint64(2992)); QCOMPARE(data->version(), 1); QCOMPARE(data->part(), 1u); @@ -144,9 +144,9 @@ void CallgrindParserTests::testSimpleFunction() { const Function *func = data->functions().at(0); - QCOMPARE(func->file(), QString("/my/file.cpp")); - QCOMPARE(func->object(), QString("/my/object")); - QCOMPARE(func->name(), QString("myFunction")); + QCOMPARE(func->file(), QLatin1String("/my/file.cpp")); + QCOMPARE(func->object(), QLatin1String("/my/object")); + QCOMPARE(func->name(), QLatin1String("myFunction")); QVERIFY(func->outgoingCalls().isEmpty()); QCOMPARE(func->called(), quint64(0)); @@ -157,7 +157,7 @@ void CallgrindParserTests::testSimpleFunction() testSimpleCostItem(func->costItems().at(2), 3, 3); testSimpleCostItem(func->costItems().at(3), 1, 1); testSimpleCostItem(func->costItems().at(4), 5, 4); - testDifferringFileCostItem(func->costItems().at(5), QString("/my/file3.h"), 1, 5); + testDifferringFileCostItem(func->costItems().at(5), QLatin1String("/my/file3.h"), 1, 5); testSimpleCostItem(func->costItems().at(6), 7, 5); QCOMPARE(func->selfCost(0), quint64(20)); QCOMPARE(func->inclusiveCost(0), quint64(20)); @@ -165,9 +165,9 @@ void CallgrindParserTests::testSimpleFunction() { const Function *func = data->functions().at(1); - QCOMPARE(func->file(), QString("/my/file.cpp")); - QCOMPARE(func->object(), QString("/my/object")); - QCOMPARE(func->name(), QString("myFunction2")); + QCOMPARE(func->file(), QLatin1String("/my/file.cpp")); + QCOMPARE(func->object(), QLatin1String("/my/object")); + QCOMPARE(func->name(), QLatin1String("myFunction2")); QVERIFY(func->incomingCalls().isEmpty()); QCOMPARE(func->called(), quint64(0)); @@ -179,9 +179,9 @@ void CallgrindParserTests::testSimpleFunction() { const Function *func = data->functions().at(2); - QCOMPARE(func->file(), QString("/my/file2.cpp")); - QCOMPARE(func->object(), QString("/my/object")); - QCOMPARE(func->name(), QString("myFunction4")); + QCOMPARE(func->file(), QLatin1String("/my/file2.cpp")); + QCOMPARE(func->object(), QLatin1String("/my/object")); + QCOMPARE(func->name(), QLatin1String("myFunction4")); QVERIFY(func->incomingCalls().isEmpty()); QCOMPARE(func->called(), quint64(0)); @@ -193,9 +193,9 @@ void CallgrindParserTests::testSimpleFunction() { const Function *func = data->functions().at(3); - QCOMPARE(func->file(), QString("/my/file.cpp")); - QCOMPARE(func->object(), QString("/my/object2")); - QCOMPARE(func->name(), QString("myFunction3")); + QCOMPARE(func->file(), QLatin1String("/my/file.cpp")); + QCOMPARE(func->object(), QLatin1String("/my/object2")); + QCOMPARE(func->name(), QLatin1String("myFunction3")); QVERIFY(func->incomingCalls().isEmpty()); QCOMPARE(func->called(), quint64(0)); @@ -213,9 +213,9 @@ void CallgrindParserTests::testCallee() // basic function data testing const Function *main = data->functions().at(0); - QCOMPARE(main->file(), QString("file1.c")); - QCOMPARE(main->object(), QString("")); - QCOMPARE(main->name(), QString("main")); + QCOMPARE(main->file(), QLatin1String("file1.c")); + QCOMPARE(main->object(), QLatin1String("")); + QCOMPARE(main->name(), QLatin1String("main")); QVERIFY(main->incomingCalls().isEmpty()); QCOMPARE(main->called(), quint64(0)); @@ -227,9 +227,9 @@ void CallgrindParserTests::testCallee() QCOMPARE(main->inclusiveCost(0), quint64(1230)); const Function *func1 = data->functions().at(1); - QCOMPARE(func1->file(), QString("file1.c")); - QCOMPARE(func1->object(), QString("")); - QCOMPARE(func1->name(), QString("func1")); + QCOMPARE(func1->file(), QLatin1String("file1.c")); + QCOMPARE(func1->object(), QLatin1String("")); + QCOMPARE(func1->name(), QLatin1String("func1")); QCOMPARE(func1->incomingCalls().size(), 1); QCOMPARE(func1->called(), quint64(1)); @@ -240,9 +240,9 @@ void CallgrindParserTests::testCallee() QCOMPARE(func1->inclusiveCost(0), quint64(400)); const Function *func2 = data->functions().at(2); - QCOMPARE(func2->file(), QString("file2.c")); - QCOMPARE(func2->object(), QString("")); - QCOMPARE(func2->name(), QString("func2")); + QCOMPARE(func2->file(), QLatin1String("file2.c")); + QCOMPARE(func2->object(), QLatin1String("")); + QCOMPARE(func2->name(), QLatin1String("func2")); QCOMPARE(func2->incomingCalls().size(), 2); QCOMPARE(func2->called(), quint64(8)); @@ -286,18 +286,18 @@ void CallgrindParserTests::testInlinedCalls() QCOMPARE(data->functions().size(), 3); const Function *main = data->functions().first(); - QCOMPARE(main->name(), QString("main")); - QCOMPARE(main->file(), QString("file1.c")); + QCOMPARE(main->name(), QLatin1String("main")); + QCOMPARE(main->file(), QLatin1String("file1.c")); QCOMPARE(main->selfCost(0), quint64(4)); QCOMPARE(main->inclusiveCost(0), quint64(804)); const Function *inlined = data->functions().at(1); - QCOMPARE(inlined->name(), QString("Something::Inlined()")); - QCOMPARE(inlined->file(), QString("file.h")); + QCOMPARE(inlined->name(), QLatin1String("Something::Inlined()")); + QCOMPARE(inlined->file(), QLatin1String("file.h")); const Function *func1 = data->functions().last(); - QCOMPARE(func1->name(), QString("func1")); - QCOMPARE(func1->file(), QString("file3.h")); + QCOMPARE(func1->name(), QLatin1String("func1")); + QCOMPARE(func1->file(), QLatin1String("file3.h")); QCOMPARE(main->outgoingCalls().size(), 2); QCOMPARE(main->costItems().at(2)->call()->callee(), inlined); @@ -395,9 +395,9 @@ void CallgrindParserTests::testCycle() QCOMPARE(b->selfCost(0), quint64(20)); QCOMPARE(data->functions(true).size(), 3); - QCOMPARE(findFunction(QString("main"), data->functions(true)), main); - QCOMPARE(findFunction(QString("A()"), data->functions(true)), a); - const FunctionCycle *cycle = dynamic_cast<const FunctionCycle*>(findFunction(QString("cycle 1"), data->functions(true))); + QCOMPARE(findFunction(QLatin1String("main"), data->functions(true)), main); + QCOMPARE(findFunction(QLatin1String("A()"), data->functions(true)), a); + const FunctionCycle *cycle = dynamic_cast<const FunctionCycle*>(findFunction(QLatin1String("cycle 1"), data->functions(true))); QVERIFY(cycle); QCOMPARE(cycle->called(), quint64(2)); QCOMPARE(cycle->inclusiveCost(0), quint64(40)); @@ -409,34 +409,34 @@ void CallgrindParserTests::testRecursiveCycle() QScopedPointer<const ParseData> data(parseDataFile(dataFile("recursiveCycle.out"))); QCOMPARE(data->functions().size(), 5); - const Function *main = findFunction(QString("main"), data->functions()); + const Function *main = findFunction(QLatin1String("main"), data->functions()); QVERIFY(main); QCOMPARE(main->inclusiveCost(0), quint64(70701765 + 3 + 4)); QCOMPARE(data->totalCost(0), main->inclusiveCost(0)); QCOMPARE(main->selfCost(0), quint64(3 + 4)); - const Function *a1 = findFunction(QString("A(int)"), data->functions()); + const Function *a1 = findFunction(QLatin1String("A(int)"), data->functions()); QVERIFY(a1); QCOMPARE(a1->inclusiveCost(0), quint64(700017 + 70001746 + 2)); QCOMPARE(a1->selfCost(0), quint64(700017 + 2)); - const Function *a2 = findFunction(QString("A(int)'2"), data->functions()); + const Function *a2 = findFunction(QLatin1String("A(int)'2"), data->functions()); QVERIFY(a2); QCOMPARE(a2->inclusiveCost(0), quint64(35000846 + 1715042679 + 100)); QCOMPARE(a2->selfCost(0), quint64(35000846 + 100)); - const Function *b1 = findFunction(QString("B(int)"), data->functions()); + const Function *b1 = findFunction(QLatin1String("B(int)"), data->functions()); QVERIFY(b1); QCOMPARE(b1->inclusiveCost(0), quint64(700014 + 69301730 + 2)); QCOMPARE(b1->selfCost(0), quint64(700014 + 2)); - const Function *b2 = findFunction(QString("B(int)'2"), data->functions()); + const Function *b2 = findFunction(QLatin1String("B(int)'2"), data->functions()); QVERIFY(b2); QCOMPARE(b2->inclusiveCost(0), quint64(34300686 + 1680741895 + 98)); QCOMPARE(b2->selfCost(0), quint64(34300686 + 98)); { // cycle detection QCOMPARE(data->functions(true).size(), 4); - QCOMPARE(findFunction(QString("main"), data->functions(true)), main); - QCOMPARE(findFunction(QString("A(int)"), data->functions(true)), a1); - QCOMPARE(findFunction(QString("B(int)"), data->functions(true)), b1); - const FunctionCycle *cycle = dynamic_cast<const FunctionCycle*>(findFunction(QString("cycle 1"), data->functions(true))); + QCOMPARE(findFunction(QLatin1String("main"), data->functions(true)), main); + QCOMPARE(findFunction(QLatin1String("A(int)"), data->functions(true)), a1); + QCOMPARE(findFunction(QLatin1String("B(int)"), data->functions(true)), b1); + const FunctionCycle *cycle = dynamic_cast<const FunctionCycle*>(findFunction(QLatin1String("cycle 1"), data->functions(true))); QVERIFY(cycle); QCOMPARE(cycle->called(), quint64(1)); const quint64 restCost = data->totalCost(0) - main->selfCost(0) - a1->selfCost(0) - b1->selfCost(0); @@ -451,17 +451,17 @@ void CallgrindParserTests::testRecursion() QCOMPARE(data->functions().size(), 3); QCOMPARE(data->totalCost(0), quint64(35700972)); - const Function *main = findFunction(QString("main"), data->functions()); + const Function *main = findFunction(QLatin1String("main"), data->functions()); QVERIFY(main); QCOMPARE(main->inclusiveCost(0), quint64(4 + 35700965 + 3)); QCOMPARE(main->selfCost(0), quint64(4 + 3)); - const Function *a1 = findFunction(QString("A(int)"), data->functions()); + const Function *a1 = findFunction(QLatin1String("A(int)"), data->functions()); QVERIFY(a1); QCOMPARE(a1->inclusiveCost(0), quint64(700010 + 35000946 + 2)); QCOMPARE(a1->selfCost(0), quint64(700010 + 2)); - const Function *a2 = findFunction(QString("A(int)'2"), data->functions()); + const Function *a2 = findFunction(QLatin1String("A(int)'2"), data->functions()); QVERIFY(a2); // inclusive cost must be the same as call-cost from a1 QCOMPARE(a2->inclusiveCost(0), quint64(35000946)); diff --git a/tests/valgrind/memcheck/parsertests.cpp b/tests/valgrind/memcheck/parsertests.cpp index 175b9b8821..cc4e0a936a 100644 --- a/tests/valgrind/memcheck/parsertests.cpp +++ b/tests/valgrind/memcheck/parsertests.cpp @@ -115,7 +115,7 @@ void ParserTests::initTest(const QLatin1String &testfile, const QStringList &oth m_process->start( fakeValgrindExecutable(), QStringList() - << QString("--xml-socket=127.0.0.1:%1").arg(m_server->serverPort()) + << QString::fromLatin1("--xml-socket=127.0.0.1:%1").arg(m_server->serverPort()) << QLatin1String("-i") << dataFile(testfile) << otherArgs @@ -282,9 +282,9 @@ void ParserTests::testMemcheckSample1() expectedErrorCounts.push_back(QPair<qint64,qint64>(9, 2)); QVector<QPair<QString,qint64> > expectedSuppCounts; - expectedSuppCounts.push_back(qMakePair(QString::fromLatin1("X on SUSE11 writev uninit padding"), static_cast<qint64>(12))); - expectedSuppCounts.push_back(qMakePair(QString::fromLatin1("dl-hack3-cond-1"), static_cast<qint64>(2))); - expectedSuppCounts.push_back(qMakePair(QString::fromLatin1("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), static_cast<qint64>(2))); + expectedSuppCounts.push_back(qMakePair(QLatin1String("X on SUSE11 writev uninit padding"), static_cast<qint64>(12))); + expectedSuppCounts.push_back(qMakePair(QLatin1String("dl-hack3-cond-1"), static_cast<qint64>(2))); + expectedSuppCounts.push_back(qMakePair(QLatin1String("glibc-2.5.x-on-SUSE-10.2-(PPC)-2a"), static_cast<qint64>(2))); Valgrind::XmlProtocol::Parser parser; Recorder rec(&parser); @@ -457,7 +457,7 @@ void ParserTests::testRealValgrind() ThreadedParser parser; Valgrind::Memcheck::MemcheckRunner runner; - runner.setValgrindExecutable(QString("valgrind")); + runner.setValgrindExecutable(QLatin1String("valgrind")); runner.setDebuggeeExecutable(executable); runner.setParser(&parser); RunnerDumper dumper(&runner, &parser); @@ -472,13 +472,13 @@ void ParserTests::testValgrindStartError_data() QTest::addColumn<QString>("debuggee"); QTest::addColumn<QString>("debuggeeArgs"); - QTest::newRow("invalid_client") << QString("valgrind") << QStringList() - << QString("please-dont-let-this-app-exist") << QString(); + QTest::newRow("invalid_client") << QLatin1String("valgrind") << QStringList() + << QLatin1String("please-dont-let-this-app-exist") << QString(); - QTest::newRow("invalid_valgrind") << QString("valgrind-that-does-not-exist") << QStringList() + QTest::newRow("invalid_valgrind") << QLatin1String("valgrind-that-does-not-exist") << QStringList() << fakeValgrindExecutable() << QString(); - QTest::newRow("invalid_valgrind_args") << QString("valgrind") << (QStringList() << "--foobar-fail") + QTest::newRow("invalid_valgrind_args") << QLatin1String("valgrind") << (QStringList() << "--foobar-fail") << fakeValgrindExecutable() << QString(); } diff --git a/tests/valgrind/memcheck/testrunner.cpp b/tests/valgrind/memcheck/testrunner.cpp index 4514fca252..5bf03a3d27 100644 --- a/tests/valgrind/memcheck/testrunner.cpp +++ b/tests/valgrind/memcheck/testrunner.cpp @@ -151,11 +151,11 @@ void TestRunner::testLeak1() QCOMPARE(stack.frames().count(), 2); { const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("operator new(unsigned long)")); + QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 5); QCOMPARE(frame.object(), binary); @@ -181,15 +181,15 @@ void TestRunner::testLeak2() QCOMPARE(stack.frames().count(), 3); { const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("malloc")); + QCOMPARE(frame.functionName(), QLatin1String("malloc")); } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("strdup")); + QCOMPARE(frame.functionName(), QLatin1String("strdup")); } { const Frame frame = stack.frames().at(2); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 7); QCOMPARE(frame.object(), binary); @@ -215,15 +215,15 @@ void TestRunner::testLeak3() QCOMPARE(stack.frames().count(), 3); { const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("malloc")); + QCOMPARE(frame.functionName(), QLatin1String("malloc")); } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("strdup")); + QCOMPARE(frame.functionName(), QLatin1String("strdup")); } { const Frame frame = stack.frames().at(2); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 7); QCOMPARE(frame.object(), binary); @@ -254,11 +254,11 @@ void TestRunner::testLeak4() QCOMPARE(stack.frames().count(), 3); { const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("operator new(unsigned long)")); + QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); } { const Frame frame = stack.frames().at(2); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 14); QCOMPARE(frame.object(), binary); @@ -267,7 +267,7 @@ void TestRunner::testLeak4() } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("Foo::Foo()")); + QCOMPARE(frame.functionName(), QLatin1String("Foo::Foo()")); QCOMPARE(frame.line(), 6); QCOMPARE(frame.object(), binary); @@ -276,7 +276,7 @@ void TestRunner::testLeak4() } { const Frame frame = stack.frames().at(2); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 14); QCOMPARE(frame.object(), binary); @@ -296,11 +296,11 @@ void TestRunner::testLeak4() QCOMPARE(stack.frames().count(), 2); { const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("operator new(unsigned long)")); + QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 14); QCOMPARE(frame.object(), binary); @@ -329,7 +329,7 @@ void TestRunner::uninit1() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 4); QCOMPARE(frame.object(), binary); @@ -343,7 +343,7 @@ void TestRunner::uninit1() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 2); QCOMPARE(frame.object(), binary); @@ -374,7 +374,7 @@ void TestRunner::uninit2() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 4); QCOMPARE(frame.object(), binary); @@ -388,7 +388,7 @@ void TestRunner::uninit2() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 2); QCOMPARE(frame.object(), binary); @@ -407,7 +407,7 @@ void TestRunner::uninit2() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 4); QCOMPARE(frame.object(), binary); @@ -438,7 +438,7 @@ void TestRunner::uninit3() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 4); QCOMPARE(frame.object(), binary); @@ -452,7 +452,7 @@ void TestRunner::uninit3() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 2); QCOMPARE(frame.object(), binary); @@ -471,7 +471,7 @@ void TestRunner::uninit3() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 4); QCOMPARE(frame.object(), binary); @@ -501,15 +501,15 @@ void TestRunner::syscall() { ///TODO: is this platform specific? const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("_Exit")); + QCOMPARE(frame.functionName(), QLatin1String("_Exit")); } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("exit")); + QCOMPARE(frame.functionName(), QLatin1String("exit")); } { const Frame frame = stack.frames().at(2); - QCOMPARE(frame.functionName(), QString("(below main)")); + QCOMPARE(frame.functionName(), QLatin1String("(below main)")); } } //BEGIN second stack @@ -519,7 +519,7 @@ void TestRunner::syscall() QCOMPARE(stack.frames().count(), 1); const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 2); QCOMPARE(frame.object(), binary); @@ -548,11 +548,11 @@ void TestRunner::free1() { const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("operator delete(void*)")); + QCOMPARE(frame.functionName(), QLatin1String("operator delete(void*)")); } { const Frame frame = stack.frames().last(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 7); QCOMPARE(frame.object(), binary); @@ -569,11 +569,11 @@ void TestRunner::free1() { const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("operator delete(void*)")); + QCOMPARE(frame.functionName(), QLatin1String("operator delete(void*)")); } { const Frame frame = stack.frames().last(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 6); QCOMPARE(frame.object(), binary); @@ -603,11 +603,11 @@ void TestRunner::free2() { const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("free")); + QCOMPARE(frame.functionName(), QLatin1String("free")); } { const Frame frame = stack.frames().last(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 6); QCOMPARE(frame.object(), binary); @@ -624,11 +624,11 @@ void TestRunner::free2() { const Frame frame = stack.frames().first(); - QCOMPARE(frame.functionName(), QString("operator new(unsigned long)")); + QCOMPARE(frame.functionName(), QLatin1String("operator new(unsigned long)")); } { const Frame frame = stack.frames().last(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 5); QCOMPARE(frame.object(), binary); @@ -661,7 +661,7 @@ void TestRunner::invalidjump() } { const Frame frame = stack.frames().at(1); - QCOMPARE(frame.functionName(), QString("(below main)")); + QCOMPARE(frame.functionName(), QLatin1String("(below main)")); } } @@ -684,11 +684,11 @@ void TestRunner::overlap() QCOMPARE(stack.frames().count(), 2); { const Frame frame = stack.frames().at(0); - QCOMPARE(frame.functionName(), QString("memcpy")); + QCOMPARE(frame.functionName(), QLatin1String("memcpy")); } { const Frame frame = stack.frames().last(); - QCOMPARE(frame.functionName(), QString("main")); + QCOMPARE(frame.functionName(), QLatin1String("main")); QCOMPARE(frame.line(), 6); QCOMPARE(frame.object(), binary); |