Commit afa85f42 authored by Kevin Funk's avatar Kevin Funk

Clazy fixit: fix-fromCharPtrAllocations

parent 624bd403
......@@ -38,7 +38,7 @@ ProjectConfigPage::ProjectConfigPage(KDevelop::IPlugin* plugin, KDevelop::IProje
ui->setupUi(this);
ui->commandLine->setFontFamily("Monospace");
ui->commandLine->setFontFamily(QStringLiteral("Monospace"));
connect(this, &ProjectConfigPage::changed, this, &ProjectConfigPage::updateCommandLine);
connect(ui->commandLineFilter->lineEdit(), &QLineEdit::textChanged, this, &ProjectConfigPage::updateCommandLine);
......@@ -102,7 +102,7 @@ void ProjectConfigPage::updateCommandLine()
return;
}
commandLine.replace(" -", "\n-");
commandLine.replace(QLatin1String(" -"), QLatin1String("\n-"));
QString filterText = ui->commandLineFilter->lineEdit()->text();
if (filterText.isEmpty()) {
ui->commandLine->setText(commandLine);
......
......@@ -70,8 +70,8 @@ Job::~Job()
void Job::postProcessStdout(const QStringList& lines)
{
static const auto fileNameRegex = QRegularExpression("Checking ([^:]*)\\.{3}");
static const auto percentRegex = QRegularExpression("(\\d+)% done");
static const auto fileNameRegex = QRegularExpression(QStringLiteral("Checking ([^:]*)\\.{3}"));
static const auto percentRegex = QRegularExpression(QStringLiteral("(\\d+)% done"));
QRegularExpressionMatch match;
......@@ -98,7 +98,7 @@ void Job::postProcessStdout(const QStringList& lines)
void Job::postProcessStderr(const QStringList& lines)
{
static const auto xmlStartRegex = QRegularExpression("\\s*<");
static const auto xmlStartRegex = QRegularExpression(QStringLiteral("\\s*<"));
for (const QString & line : lines) {
// unfortunately sometime cppcheck send non-XML messages to stderr.
......@@ -122,7 +122,7 @@ void Job::postProcessStderr(const QStringList& lines)
problem->setSeverity(KDevelop::IProblem::Error);
problem->setDescription(line);
problem->setExplanation("Check your cppcheck settings");
problem->setExplanation(QStringLiteral("Check your cppcheck settings"));
m_problems = {problem};
emitProblems();
......
......@@ -126,8 +126,8 @@ QStringList Parameters::commandLine() const
QStringList Parameters::commandLine(QString& infoMessage) const
{
static const auto mocHeaderRegex = QRegularExpression("#define\\s+Q_MOC_OUTPUT_REVISION\\s+(.+)");
static const auto mocParametersRegex = QRegularExpression("-DQ_MOC_OUTPUT_REVISION=\\d{2,}");
static const auto mocHeaderRegex = QRegularExpression(QStringLiteral("#define\\s+Q_MOC_OUTPUT_REVISION\\s+(.+)"));
static const auto mocParametersRegex = QRegularExpression(QStringLiteral("-DQ_MOC_OUTPUT_REVISION=\\d{2,}"));
const QString mocMessage = i18n(
"It seems that this project uses Qt library. For correctly work of cppcheck "
......@@ -184,7 +184,7 @@ QStringList Parameters::commandLine(QString& infoMessage) const
bool qtUsed = false;
bool mocDefineFound = false;
foreach (auto dir, m_includeDirectories) {
if (dir.path().endsWith("QtCore")) {
if (dir.path().endsWith(QLatin1String("QtCore"))) {
qtUsed = true;
QFile qtHeader(dir.path() + QStringLiteral("/qobjectdefs.h"));
......@@ -252,8 +252,8 @@ QString Parameters::applyPlaceholders(const QString& text) const
QString result(text);
if (m_project) {
result.replace("%p", m_projectRootPath.toLocalFile());
result.replace("%b", m_projectBuildPath.toLocalFile());
result.replace(QLatin1String("%p"), m_projectRootPath.toLocalFile());
result.replace(QLatin1String("%b"), m_projectBuildPath.toLocalFile());
}
return result;
......
......@@ -52,13 +52,13 @@ namespace cppcheck
*/
QString verboseMessageToHtml( const QString & input )
{
QString output(QString("<html>%1</html>").arg(input.toHtmlEscaped()));
QString output(QStringLiteral("<html>%1</html>").arg(input.toHtmlEscaped()));
output.replace("\\012", "\n");
output.replace(QLatin1String("\\012"), QLatin1String("\n"));
if (output.count('\n') >= 2) {
output.replace(output.indexOf('\n'), 1, "<pre>" );
output.replace(output.lastIndexOf('\n'), 1, "</pre><br>" );
output.replace(output.indexOf('\n'), 1, QLatin1String("<pre>") );
output.replace(output.lastIndexOf('\n'), 1, QLatin1String("</pre><br>") );
}
return output;
......@@ -98,45 +98,45 @@ bool CppcheckParser::startElement()
else if (name() == "location") {
newState = Location;
if (attributes().hasAttribute("file") && attributes().hasAttribute("line")) {
QString errorFile = attributes().value("file").toString();
if (attributes().hasAttribute(QStringLiteral("file")) && attributes().hasAttribute(QStringLiteral("line"))) {
QString errorFile = attributes().value(QStringLiteral("file")).toString();
// Usually when "file0" attribute exists it associated with source and
// attribute "file" associated with header).
// But sometimes cppcheck produces errors with "file" and "file0" attributes
// both associated with same *source* file. In such cases attribute "file" contains
// only file name, without full path. Therefore we should use "file0" instead "file".
if (!QFile::exists(errorFile) && attributes().hasAttribute("file0")) {
errorFile = attributes().value("file0").toString();
if (!QFile::exists(errorFile) && attributes().hasAttribute(QStringLiteral("file0"))) {
errorFile = attributes().value(QStringLiteral("file0")).toString();
}
m_errorFiles += errorFile;
m_errorLines += attributes().value("line").toString().toInt();
m_errorLines += attributes().value(QStringLiteral("line")).toString().toInt();
}
}
else if (name() == "error") {
newState = Error;
m_errorSeverity = "unknown";
m_errorSeverity = QLatin1String("unknown");
m_errorInconclusive = false;
m_errorFiles.clear();
m_errorLines.clear();
m_errorMessage.clear();
m_errorVerboseMessage.clear();
if (attributes().hasAttribute("msg")) {
m_errorMessage = attributes().value("msg").toString();
if (attributes().hasAttribute(QStringLiteral("msg"))) {
m_errorMessage = attributes().value(QStringLiteral("msg")).toString();
}
if (attributes().hasAttribute("verbose")) {
m_errorVerboseMessage = verboseMessageToHtml(attributes().value("verbose").toString());
if (attributes().hasAttribute(QStringLiteral("verbose"))) {
m_errorVerboseMessage = verboseMessageToHtml(attributes().value(QStringLiteral("verbose")).toString());
}
if (attributes().hasAttribute("severity")) {
m_errorSeverity = attributes().value("severity").toString();
if (attributes().hasAttribute(QStringLiteral("severity"))) {
m_errorSeverity = attributes().value(QStringLiteral("severity")).toString();
}
if (attributes().hasAttribute("inconclusive")) {
if (attributes().hasAttribute(QStringLiteral("inconclusive"))) {
m_errorInconclusive = true;
}
}
......@@ -159,8 +159,8 @@ bool CppcheckParser::endElement(QVector<KDevelop::IProblem::Ptr>& problems)
switch (state) {
case CppCheck:
if (attributes().hasAttribute("version")) {
qCDebug(KDEV_CPPCHECK) << "Cppcheck report version: " << attributes().value("version");
if (attributes().hasAttribute(QStringLiteral("version"))) {
qCDebug(KDEV_CPPCHECK) << "Cppcheck report version: " << attributes().value(QStringLiteral("version"));
}
break;
......@@ -170,8 +170,8 @@ bool CppcheckParser::endElement(QVector<KDevelop::IProblem::Ptr>& problems)
case Error:
qCDebug(KDEV_CPPCHECK) << "CppcheckParser::endElement: new error elem: line: "
<< (m_errorLines.isEmpty() ? "?" : QString::number(m_errorLines.first()))
<< " at " << (m_errorFiles.isEmpty() ? "?" : m_errorFiles.first())
<< (m_errorLines.isEmpty() ? QStringLiteral("?") : QString::number(m_errorLines.first()))
<< " at " << (m_errorFiles.isEmpty() ? QStringLiteral("?") : m_errorFiles.first())
<< ", msg: " << m_errorMessage;
storeError(problems);
......@@ -263,11 +263,11 @@ KDevelop::IProblem::Ptr CppcheckParser::getProblem(int locationIdx) const
QStringList messagePrefix;
QString errorMessage(m_errorMessage);
if (m_errorSeverity == "error") {
if (m_errorSeverity == QLatin1String("error")) {
problem->setSeverity(KDevelop::IProblem::Error);
}
else if (m_errorSeverity == "warning") {
else if (m_errorSeverity == QLatin1String("warning")) {
problem->setSeverity(KDevelop::IProblem::Warning);
}
......@@ -278,11 +278,11 @@ KDevelop::IProblem::Ptr CppcheckParser::getProblem(int locationIdx) const
}
if (m_errorInconclusive) {
messagePrefix.push_back("inconclusive");
messagePrefix.push_back(QStringLiteral("inconclusive"));
}
if (!messagePrefix.isEmpty()) {
errorMessage = QString("(%1) %2").arg(messagePrefix.join(", ")).arg(m_errorMessage);
errorMessage = QStringLiteral("(%1) %2").arg(messagePrefix.join(QStringLiteral(", "))).arg(m_errorMessage);
}
problem->setDescription(errorMessage);
......
......@@ -49,27 +49,27 @@ namespace cppcheck
{
Plugin::Plugin(QObject* parent, const QVariantList&)
: IPlugin("kdevcppcheck", parent)
: IPlugin(QStringLiteral("kdevcppcheck"), parent)
, m_job(nullptr)
, m_currentProject(nullptr)
, m_model(new ProblemModel(this))
{
qCDebug(KDEV_CPPCHECK) << "setting cppcheck rc file";
setXMLFile("kdevcppcheck.rc");
setXMLFile(QStringLiteral("kdevcppcheck.rc"));
m_actionFile = new QAction(QIcon::fromTheme("cppcheck"), i18n("Cppcheck (Current File)"), this);
m_actionFile = new QAction(QIcon::fromTheme(QStringLiteral("cppcheck")), i18n("Cppcheck (Current File)"), this);
connect(m_actionFile, &QAction::triggered, [this](){
runCppcheck(false);
});
actionCollection()->addAction("cppcheck_file", m_actionFile);
actionCollection()->addAction(QStringLiteral("cppcheck_file"), m_actionFile);
m_actionProject = new QAction(QIcon::fromTheme("cppcheck"), i18n("Cppcheck (Current Project)"), this);
m_actionProject = new QAction(QIcon::fromTheme(QStringLiteral("cppcheck")), i18n("Cppcheck (Current Project)"), this);
connect(m_actionProject, &QAction::triggered, [this](){
runCppcheck(true);
});
actionCollection()->addAction("cppcheck_project", m_actionProject);
actionCollection()->addAction(QStringLiteral("cppcheck_project"), m_actionProject);
m_actionProjectItem = new QAction(QIcon::fromTheme("cppcheck"), i18n("Cppcheck"), this);
m_actionProjectItem = new QAction(QIcon::fromTheme(QStringLiteral("cppcheck")), i18n("Cppcheck"), this);
connect(core()->documentController(), &KDevelop::IDocumentController::documentClosed,
this, &Plugin::updateActions);
......@@ -175,7 +175,7 @@ void Plugin::runCppcheck(KDevelop::IProject* project, const QString& path)
connect(m_job, &Job::problemsDetected, m_model.data(), &ProblemModel::addProblems);
connect(m_job, &Job::finished, this, &Plugin::result);
core()->uiController()->registerStatus(new KDevelop::JobStatus(m_job, "Cppcheck"));
core()->uiController()->registerStatus(new KDevelop::JobStatus(m_job, QStringLiteral("Cppcheck")));
core()->runController()->registerJob(m_job);
if (params.hideOutputView) {
......
......@@ -140,7 +140,7 @@ void ProblemModel::reset(KDevelop::IProject* project, const QString& path)
QString tooltip = i18nc("@info:tooltip", "Re-Run Last Cppcheck Analysis");
if (m_project) {
tooltip += QString(" (%1)").arg(prettyPathName(m_path));
tooltip += QStringLiteral(" (%1)").arg(prettyPathName(m_path));
}
setFullUpdateTooltip(tooltip);
}
......
......@@ -112,7 +112,7 @@ Job::~Job()
QString Job::statusName() const
{
QString target = m_pid < 0 ? QFileInfo(m_analyzedExecutable).fileName()
: QString("PID: %1").arg(m_pid);
: QStringLiteral("PID: %1").arg(m_pid);
return i18n("Heaptrack Analysis (%1)", target);
}
......
......@@ -35,7 +35,7 @@ void KDevIDEExtension::init()
QString KDevIDEExtension::xmlFile()
{
return "kdevelopui.rc";
return QStringLiteral("kdevelopui.rc");
}
QString KDevIDEExtension::executableFilePath()
......@@ -51,7 +51,7 @@ KDevelop::AreaParams KDevIDEExtension::defaultArea()
QString KDevIDEExtension::projectFileExtension()
{
return "kdev4";
return QStringLiteral("kdev4");
}
QString KDevIDEExtension::projectFileDescription()
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ void KDevelopSessionsEngine::init()
{
m_dirWatch = new KDirWatch( this );
const QStringList sessionDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "kdevelop/sessions", QStandardPaths::LocateDirectory );
const QStringList sessionDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kdevelop/sessions"), QStandardPaths::LocateDirectory );
for ( int i = 0; i < sessionDirs.count(); ++i )
m_dirWatch->addDir( sessionDirs[i], KDirWatch::WatchSubDirs );
......@@ -58,13 +58,13 @@ Plasma::Service *KDevelopSessionsEngine::serviceForSource(const QString &source)
QStringList findSessions()
{
QStringList sessionDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "kdevelop/sessions", QStandardPaths::LocateDirectory);
QStringList sessionDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("kdevelop/sessions"), QStandardPaths::LocateDirectory);
QStringList sessionrcs;
Q_FOREACH(const QString& dir, sessionDirs) {
QDir d(dir);
Q_FOREACH(const QString& sessionDir, d.entryList(QDir::Dirs)) {
QDir sd(d.absoluteFilePath(sessionDir));
QString path(sd.filePath("sessionrc"));
QString path(sd.filePath(QStringLiteral("sessionrc")));
if(QFile::exists(path)) {
sessionrcs += path;
}
......@@ -108,8 +108,8 @@ void KDevelopSessionsEngine::updateSessions()
// Publish new session.
m_currentSessions.insert( session.hash, session );
setData( session.hash, "sessionName", session.name );
setData( session.hash, "sessionString", session.description );
setData( session.hash, QStringLiteral("sessionName"), session.name );
setData( session.hash, QStringLiteral("sessionString"), session.description );
}
else
{
......@@ -123,14 +123,14 @@ void KDevelopSessionsEngine::updateSessions()
{
oldSession.name = session.name;
modified = true;
setData( session.hash, "sessionName", session.name );
setData( session.hash, QStringLiteral("sessionName"), session.name );
}
if ( session.description != oldSession.description )
{
oldSession.description = session.description;
modified = true;
setData( session.hash, "sessionString", session.description );
setData( session.hash, QStringLiteral("sessionString"), session.description );
}
if ( modified )
......
......@@ -24,7 +24,7 @@
KDevelopSessionsService::KDevelopSessionsService(QObject* parent, const QString& sessionName)
: Plasma::Service(parent)
{
setName("org.kde.plasma.dataengine.kdevelopsessions");
setName(QStringLiteral("org.kde.plasma.dataengine.kdevelopsessions"));
setDestination(sessionName);
}
......@@ -40,11 +40,11 @@ SessionJob::SessionJob(KDevelopSessionsService *service, const QString &operatio
void SessionJob::start()
{
if (operationName() == "open")
if (operationName() == QLatin1String("open"))
{
QStringList args;
args << "--open-session" << destination();
KToolInvocation::kdeinitExec("kdevelop", args);
args << QStringLiteral("--open-session") << destination();
KToolInvocation::kdeinitExec(QStringLiteral("kdevelop"), args);
setResult(true);
}
......
......@@ -340,7 +340,7 @@ namespace KDevMI { namespace MI {
inline PromptRecord() { Record::kind = Prompt; }
QString toString() const override
{ return "(prompt)\n"; }
{ return QStringLiteral("(prompt)\n"); }
};
struct StreamRecord : public Record
......
This diff is collapsed.
......@@ -294,7 +294,7 @@ public:
QString cmdToSend() override
{
return "";
return QLatin1String("");
}
private:
......@@ -320,7 +320,7 @@ public:
void handleResponse(const ResultRecord& r)
{
(handler_this.data()->*handler_method)(r["value"].literal());
(handler_this.data()->*handler_method)(r[QStringLiteral("value")].literal());
}
private:
......
This diff is collapsed.
......@@ -201,7 +201,7 @@ void MIDebugger::processLine(const QByteArray& line)
}
// GDB doc: "running" and "exit" are status codes equivalent to "done"
if (result.reason == "done" || result.reason == "running" || result.reason == "exit")
if (result.reason == QLatin1String("done") || result.reason == QLatin1String("running") || result.reason == QLatin1String("exit"))
{
qCDebug(DEBUGGERCOMMON) << "Result token is" << result.token;
currentCmd_->markAsCompleted();
......@@ -211,7 +211,7 @@ void MIDebugger::processLine(const QByteArray& line)
<< currentCmd_->gdbProcessingTime();
currentCmd_->invokeHandler(result);
}
else if (result.reason == "error")
else if (result.reason == QLatin1String("error"))
{
qCDebug(DEBUGGERCOMMON) << "Handling error";
currentCmd_->markAsCompleted();
......@@ -246,11 +246,11 @@ void MIDebugger::processLine(const QByteArray& line)
switch (async.subkind) {
case MI::AsyncRecord::Exec: {
// Prefix '*'; asynchronous state changes of the target
if (async.reason == "stopped")
if (async.reason == QLatin1String("stopped"))
{
emit programStopped(async);
}
else if (async.reason == "running")
else if (async.reason == QLatin1String("running"))
{
emit programRunning();
}
......@@ -329,7 +329,7 @@ void MIDebugger::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
qCDebug(DEBUGGERCOMMON) << "Debugger FINISHED\n";
bool abnormal = exitCode != 0 || exitStatus != QProcess::NormalExit;
emit userCommandOutput("Process exited\n");
emit userCommandOutput(QStringLiteral("Process exited\n"));
emit exited(abnormal, i18n("Process exited"));
}
......@@ -346,7 +346,7 @@ void MIDebugger::processErrored(QProcess::ProcessError error)
debuggerExecutable_),
i18n("Could not start debugger"));
emit userCommandOutput("Process failed to start\n");
emit userCommandOutput(QStringLiteral("Process failed to start\n"));
emit exited(true, i18n("Process failed to start"));
} else if (error == QProcess::Crashed) {
......@@ -359,7 +359,7 @@ void MIDebugger::processErrored(QProcess::ProcessError error)
debuggerExecutable_),
i18n("Debugger crashed"));
emit userCommandOutput("Process crashed\n");
emit userCommandOutput(QStringLiteral("Process crashed\n"));
emit exited(true, i18n("Process crashed"));
}
}
......@@ -70,7 +70,7 @@ void MIDebuggerPlugin::setupActions(const QString& displayName)
KActionCollection* ac = actionCollection();
QAction * action = new QAction(this);
action->setIcon(QIcon::fromTheme("core"));
action->setIcon(QIcon::fromTheme(QStringLiteral("core")));
action->setText(i18n("Examine Core File with %1", displayName));
action->setWhatsThis(i18n("<b>Examine core file</b>"
"<p>This loads a core file, which is typically created "
......@@ -79,16 +79,16 @@ void MIDebuggerPlugin::setupActions(const QString& displayName)
"image of the program memory at the time it crashed, "
"allowing you to do a post-mortem analysis.</p>"));
connect(action, &QAction::triggered, this, &MIDebuggerPlugin::slotExamineCore);
ac->addAction("debug_core", action);
ac->addAction(QStringLiteral("debug_core"), action);
#if KF5SysGuard_FOUND
action = new QAction(this);
action->setIcon(QIcon::fromTheme("connect_creating"));
action->setIcon(QIcon::fromTheme(QStringLiteral("connect_creating")));
action->setText(i18n("Attach to Process with %1", displayName));
action->setWhatsThis(i18n("<b>Attach to process</b>"
"<p>Attaches the debugger to a running process.</p>"));
connect(action, &QAction::triggered, this, &MIDebuggerPlugin::slotAttachProcess);
ac->addAction("debug_attach", action);
ac->addAction(QStringLiteral("debug_attach"), action);
#endif
}
......@@ -121,9 +121,9 @@ MIDebuggerPlugin::~MIDebuggerPlugin()
void MIDebuggerPlugin::slotDBusServiceRegistered(const QString& service)
{
if (service.startsWith("org.kde.drkonqi")) {
if (service.startsWith(QLatin1String("org.kde.drkonqi"))) {
// New registration
QDBusInterface* drkonqiInterface = new QDBusInterface(service, "/krashinfo",
QDBusInterface* drkonqiInterface = new QDBusInterface(service, QStringLiteral("/krashinfo"),
QString(), QDBusConnection::sessionBus(),
this);
m_drkonqis.insert(service, drkonqiInterface);
......@@ -131,13 +131,13 @@ void MIDebuggerPlugin::slotDBusServiceRegistered(const QString& service)
connect(drkonqiInterface, SIGNAL(acceptDebuggingApplication()), m_drkonqiMap, SLOT(map()));
m_drkonqiMap->setMapping(drkonqiInterface, drkonqiInterface);
drkonqiInterface->call("registerDebuggingApplication", i18n("KDevelop"));
drkonqiInterface->call(QStringLiteral("registerDebuggingApplication"), i18n("KDevelop"));
}
}
void MIDebuggerPlugin::slotDBusServiceUnregistered(const QString& service)
{
if (service.startsWith("org.kde.drkonqi")) {
if (service.startsWith(QLatin1String("org.kde.drkonqi"))) {
// Deregistration
if (m_drkonqis.contains(service))
delete m_drkonqis.take(service);
......@@ -148,7 +148,7 @@ void MIDebuggerPlugin::slotDebugExternalProcess(QObject* interface)
{
auto dbusInterface = static_cast<QDBusInterface*>(interface);
QDBusReply<int> reply = dbusInterface->call("pid");
QDBusReply<int> reply = dbusInterface->call(QStringLiteral("pid"));
if (reply.isValid()) {
attachProcess(reply.value());
QTimer::singleShot(500, this, &MIDebuggerPlugin::slotCloseDrKonqi);
......@@ -162,8 +162,8 @@ void MIDebuggerPlugin::slotDebugExternalProcess(QObject* interface)
void MIDebuggerPlugin::slotCloseDrKonqi()
{
if (!m_drkonqi.isEmpty()) {
QDBusInterface drkonqiInterface(m_drkonqi, "/MainApplication", "org.kde.KApplication");
drkonqiInterface.call("quit");
QDBusInterface drkonqiInterface(m_drkonqi, QStringLiteral("/MainApplication"), QStringLiteral("org.kde.KApplication"));
drkonqiInterface.call(QStringLiteral("quit"));
m_drkonqi.clear();
}
}
......
......@@ -106,8 +106,8 @@ void MIDebugJob::start()
setTitle(m_launchcfg->name());
KConfigGroup grp = m_launchcfg->config();
QString startWith = grp.readEntry(Config::StartWithEntry, QString("ApplicationOutput"));
if (startWith == "ApplicationOutput") {
QString startWith = grp.readEntry(Config::StartWithEntry, QStringLiteral("ApplicationOutput"));
if (startWith == QLatin1String("ApplicationOutput")) {
setVerbosity(Verbose);
} else {
setVerbosity(Silent);
......
This diff is collapsed.
......@@ -34,21 +34,21 @@ using namespace KDevMI::MI;
QString getFunctionOrAddress(const Value &frame)
{
if (frame.hasField("func"))
return frame["func"].literal();
if (frame.hasField(QStringLiteral("func")))
return frame[QStringLiteral("func")].literal();
else
return frame["addr"].literal();
return frame[QStringLiteral("addr")].literal();
}
QPair<QString, int> getSource(const Value &frame)
{
QPair<QString, int> ret(QString(), -1);
if (frame.hasField("fullname"))
ret=qMakePair(frame["fullname"].literal(), frame["line"].toInt()-1);
else if (frame.hasField("file"))
ret=qMakePair(frame["file"].literal(), frame["line"].toInt()-1);
else if (frame.hasField("from"))
ret.first=frame["from"].literal();
if (frame.hasField(QStringLiteral("fullname")))
ret=qMakePair(frame[QStringLiteral("fullname")].literal(), frame[QStringLiteral("line")].toInt()-1);
else if (frame.hasField(QStringLiteral("file")))
ret=qMakePair(frame[QStringLiteral("file")].literal(), frame[QStringLiteral("line")].toInt()-1);
else if (frame.hasField(QStringLiteral("from")))
ret.first=frame[QStringLiteral("from")].literal();
return ret;
}
......@@ -65,20 +65,20 @@ MIDebugSession * MIFrameStackModel::session()
void MIFrameStackModel::fetchThreads()
{
session()->addCommand(ThreadInfo, "", this, &MIFrameStackModel::handleThreadInfo);
session()->addCommand(ThreadInfo, QLatin1String(""), this, &MIFrameStackModel::handleThreadInfo);
}
void MIFrameStackModel::handleThreadInfo(const ResultRecord& r)
{
const Value& threads = r["threads"];
const Value& threads = r[QStringLiteral("threads")];
QList<FrameStackModel::ThreadItem> threadsList;
for (int i = 0; i!= threads.size(); ++i) {
const auto &threadMI = threads[i];
FrameStackModel::ThreadItem threadItem;
threadItem.nr = threadMI["id"].toInt();
if (threadMI["state"].literal() == "stopped") {
threadItem.name = getFunctionOrAddress(threadMI["frame"]);
threadItem.nr = threadMI[QStringLiteral("id")].toInt();
if (threadMI[QStringLiteral("state")].literal() == QLatin1String("stopped")) {
threadItem.name = getFunctionOrAddress(threadMI[QStringLiteral("frame")]);
} else {
i18n("(running)");