Remove braces for single lines of conditions

#!/usr/bin/env ruby

Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}

Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Orgad Shaneh
2013-01-08 03:32:53 +02:00
committed by hjk
parent 73a2717bed
commit 29a93998df
396 changed files with 1856 additions and 3135 deletions

View File

@@ -398,11 +398,10 @@ void BreakHandler::loadBreakpoints()
v = map.value(_("message"));
if (v.isValid())
data.message = v.toString();
if (data.isValid()) {
if (data.isValid())
appendBreakpoint(data);
} else {
else
qWarning("Not restoring invalid breakpoint: %s", qPrintable(data.toString()));
}
}
//qDebug() << "LOADED BREAKPOINTS" << this << list.size();
}

View File

@@ -494,11 +494,10 @@ void BreakpointDialog::setParts(unsigned mask, const BreakpointParameters &data)
}
if (mask & ExpressionPart) {
if (!data.expression.isEmpty()) {
if (!data.expression.isEmpty())
m_lineEditExpression->setText(data.expression);
} else {
else
m_lineEditExpression->clear();
}
}
if (mask & ConditionPart)

View File

@@ -957,11 +957,10 @@ void CdbEngine::processFinished()
m_process.exitStatus(), m_process.exitCode());
const bool crashed = m_process.exitStatus() == QProcess::CrashExit;
if (crashed) {
if (crashed)
showMessage(tr("CDB crashed"), LogError); // not in your life.
} else {
else
showMessage(tr("CDB exited (%1)").arg(m_process.exitCode()), LogMisc);
}
if (m_notifyEngineShutdownOnTermination) {
if (crashed) {
@@ -1155,11 +1154,10 @@ void CdbEngine::interruptInferior()
qDebug() << "CdbEngine::interruptInferior()" << stateName(state());
bool ok = false;
if (!canInterruptInferior()) {
if (!canInterruptInferior())
showMessage(tr("Interrupting is not possible in remote sessions."), LogError);
} else {
else
ok = doInterruptInferior(NoSpecialStop);
}
// Restore running state if stop failed.
if (!ok) {
STATE_DEBUG(state(), Q_FUNC_INFO, __LINE__, "notifyInferiorStopOk")
@@ -1456,11 +1454,10 @@ void CdbEngine::activateFrame(int index)
if (showAssembler) { // Assembly code: Clean out model and force instruction mode.
watchHandler()->removeAllData();
QAction *assemblerAction = theAssemblerAction();
if (assemblerAction->isChecked()) {
if (assemblerAction->isChecked())
gotoLocation(frame);
} else {
else
assemblerAction->trigger(); // Seems to trigger update
}
} else {
gotoLocation(frame);
updateLocals(true);
@@ -1751,11 +1748,10 @@ void CdbEngine::fetchMemory(MemoryAgent *agent, QObject *editor, quint64 addr, q
if (debug)
qDebug("CdbEngine::fetchMemory %llu bytes from 0x%llx", length, addr);
const MemoryViewCookie cookie(agent, editor, addr, length);
if (m_accessible) {
if (m_accessible)
postFetchMemory(cookie);
} else {
else
doInterruptInferiorCustomSpecialStop(qVariantFromValue(cookie));
}
}
void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie)
@@ -1920,9 +1916,8 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
GdbMi root;
root.fromString(reply->reply);
QTC_ASSERT(root.isList(), return);
if (debugLocals) {
if (debugLocals)
qDebug() << root.toString(true, 4);
}
// Courtesy of GDB engine
foreach (const GdbMi &child, root.children()) {
WatchData dummy;
@@ -2093,13 +2088,12 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
}
}
QString tid = QString::number(threadId);
if (id && breakHandler()->type(id) == WatchpointAtAddress) {
if (id && breakHandler()->type(id) == WatchpointAtAddress)
*message = msgWatchpointByAddressTriggered(id, number, breakHandler()->address(id), tid);
} else if (id && breakHandler()->type(id) == WatchpointAtExpression) {
else if (id && breakHandler()->type(id) == WatchpointAtExpression)
*message = msgWatchpointByExpressionTriggered(id, number, breakHandler()->expression(id), tid);
} else {
else
*message = msgBreakpointTriggered(id, number, tid);
}
rc |= StopReportStatusMessage|StopNotifyStop;
return rc;
}
@@ -2337,11 +2331,10 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QByteArray &what
QDebug nospace = qDebug().nospace();
nospace << "handleExtensionMessage " << t << ' ' << token << ' ' << what
<< ' ' << stateName(state());
if (t == 'N' || debug > 1) {
if (t == 'N' || debug > 1)
nospace << ' ' << message;
} else {
else
nospace << ' ' << message.size() << " bytes";
}
}
// Is there a reply expected, some command queued?
@@ -2912,11 +2905,10 @@ void CdbEngine::handleStackTrace(const CdbExtensionCommandPtr &command)
void CdbEngine::handleExpression(const CdbExtensionCommandPtr &command)
{
int value = 0;
if (command->success) {
if (command->success)
value = command->reply.toInt();
} else {
else
showMessage(QString::fromLocal8Bit(command->errorMessage), LogError);
}
// Is this a conditional breakpoint?
if (command->cookie.isValid() && command->cookie.canConvert<ConditionalBreakPointCookie>()) {
const ConditionalBreakPointCookie cookie = qvariant_cast<ConditionalBreakPointCookie>(command->cookie);
@@ -2927,11 +2919,10 @@ void CdbEngine::handleExpression(const CdbExtensionCommandPtr &command)
arg(cookie.id.toString());
showMessage(message, LogMisc);
// Stop if evaluation is true, else continue
if (value) {
if (value)
processStop(cookie.stopReason, true);
} else {
else
postCommand("g", 0);
}
}
}
@@ -3087,11 +3078,10 @@ void CdbEngine::handleBreakPoints(const GdbMi &value)
}
} // not pending reported
} // foreach
if (m_pendingBreakpointMap.empty()) {
if (m_pendingBreakpointMap.empty())
str << QLatin1String("All breakpoints have been resolved.\n");
} else {
else
str << QString::fromLatin1("%1 breakpoint(s) pending...\n").arg(m_pendingBreakpointMap.size());
}
showMessage(message, LogMisc);
}

View File

@@ -385,11 +385,10 @@ QString debugByteArray(const QByteArray &a)
str << "\\r";
break;
default:
if (uc >=32 && uc < 128) {
if (uc >=32 && uc < 128)
str << a.at(i);
} else {
else
str << '<' << unsigned(uc) << '>';
}
break;
}
}
@@ -614,9 +613,8 @@ DisassemblerLines parseCdbDisassembler(const QList<QByteArray> &a)
}
// Determine address of function from the first assembler line after a
// function header line.
if (!functionAddress && disassemblyLine.address) {
if (!functionAddress && disassemblyLine.address)
functionAddress = disassemblyLine.address - functionOffset;
}
if (functionAddress && disassemblyLine.address)
disassemblyLine.offset = disassemblyLine.address - functionAddress;
disassemblyLine.function = currentFunction;

View File

@@ -537,11 +537,10 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
consoleManager->printToConsolePane(QmlJS::ConsoleItem::UndefinedType, msg);
debuggerCore()->showMessage(msg, channel, timeout);
if (d->m_runControl) {
if (d->m_runControl)
d->m_runControl->showMessage(msg, channel);
} else {
else
qWarning("Warning: %s (no active run control)", qPrintable(msg));
}
}
void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
@@ -986,9 +985,8 @@ void DebuggerEngine::notifyInferiorStopOk()
showMessage(_("NOTE: ... FORWARDING TO 'STOP OK'. "));
setState(InferiorStopOk);
}
if (state() == InferiorStopOk || state() == InferiorStopFailed) {
if (state() == InferiorStopOk || state() == InferiorStopFailed)
d->queueShutdownInferior();
}
showMessage(_("NOTE: ... IGNORING STOP MESSAGE"));
return;
}

View File

@@ -140,11 +140,10 @@ DebuggerKitConfigDialog::DebuggerKitConfigDialog(QWidget *parent)
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(GdbEngineType), QVariant(int(GdbEngineType)));
if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) {
if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS)
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(CdbEngineType), QVariant(int(CdbEngineType)));
} else {
else
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(LldbEngineType), QVariant(int(LldbEngineType)));
}
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshLabel()));
QLabel *engineTypeLabel = new QLabel(tr("&Engine:"));
engineTypeLabel->setBuddy(m_comboBox);

View File

@@ -217,11 +217,10 @@ static unsigned debuggerConfigurationErrors(const ProjectExplorer::Kit *k)
return NoDebugger;
const QFileInfo fi = item.binary.toFileInfo();
if (!fi.exists() || fi.isDir()) {
if (!fi.exists() || fi.isDir())
result |= DebuggerNotFound;
} else if (!fi.isExecutable()) {
else if (!fi.isExecutable())
result |= DebuggerNotExecutable;
}
if (!fi.exists() || fi.isDir())
// We need an absolute path to be able to locate Python on Windows.

View File

@@ -1192,9 +1192,8 @@ public slots:
// Go to source only if we have the file.
if (currentEngine()->stackHandler()->currentIndex() >= 0) {
const StackFrame frame = currentEngine()->stackHandler()->currentFrame();
if (operateByInstructionTriggered || frame.isUsable()) {
if (operateByInstructionTriggered || frame.isUsable())
currentEngine()->gotoLocation(Location(frame, true));
}
}
}

View File

@@ -604,9 +604,8 @@ DebuggerRunControl *DebuggerRunControlFactory::doCreate
DebuggerStartParameters sp = sp0;
if (!debuggerCore()->boolSetting(AutoEnrichParameters)) {
const QString sysroot = sp.sysRoot;
if (sp.debugInfoLocation.isEmpty()) {
if (sp.debugInfoLocation.isEmpty())
sp.debugInfoLocation = sysroot + QLatin1String("/usr/lib/debug");
}
if (sp.debugSourceLocation.isEmpty()) {
QString base = sysroot + QLatin1String("/usr/src/debug/");
sp.debugSourceLocation.append(base + QLatin1String("qt5base/src/corelib"));

View File

@@ -280,11 +280,10 @@ void StandardItemTreeModelBuilder::addItem(const QString &s)
void StandardItemTreeModelBuilder::pushRow()
{
if (m_rowParents.isEmpty()) {
if (m_rowParents.isEmpty())
m_model->appendRow(m_row);
} else {
else
m_rowParents.top()->appendRow(m_row);
}
m_rowParents.push(m_row.front());
m_row.clear();
}
@@ -379,11 +378,10 @@ void XmlWriterTreeModelVisitor::run()
void XmlWriterTreeModelVisitor::handleItem(const QModelIndex &m)
{
const QString value = m.data(Qt::DisplayRole).toString();
if (value.isEmpty()) {
if (value.isEmpty())
m_writer.writeEmptyElement(m_modelItemElement);
} else {
else
m_writer.writeTextElement(m_modelItemElement, value);
}
}
// TreeModelVisitor for debugging/copying models
@@ -1030,11 +1028,10 @@ void DebuggerToolTipWidget::restoreTreeModel(QXmlStreamReader &r, QStandardItemM
case QXmlStreamReader::EndElement: {
const QStringRef element = r.name();
// Row closing: pop off parent.
if (element == QLatin1String(modelRowElementC)) {
if (element == QLatin1String(modelRowElementC))
builder.endRow();
} else if (element == QLatin1String(modelElementC)) {
else if (element == QLatin1String(modelElementC))
withinModel = false;
}
}
break; // EndElement
default:
@@ -1145,11 +1142,10 @@ void DebuggerToolTipManager::registerToolTip(DebuggerToolTipWidget *toolTipWidge
void DebuggerToolTipManager::purgeClosedToolTips()
{
for (DebuggerToolTipWidgetList::iterator it = m_tooltips.begin(); it != m_tooltips.end() ; ) {
if (it->isNull()) {
if (it->isNull())
it = m_tooltips.erase(it);
} else {
else
++it;
}
}
}
@@ -1272,11 +1268,10 @@ void DebuggerToolTipManager::slotUpdateVisibleToolTips()
// Reposition and show all tooltips of that file.
const QString fileName = toolTipEditor.fileName();
foreach (const QPointer<DebuggerToolTipWidget> &tw, m_tooltips) {
if (tw->fileName() == fileName) {
if (tw->fileName() == fileName)
tw->positionShow(toolTipEditor);
} else {
else
tw->hide();
}
}
}

View File

@@ -552,11 +552,10 @@ void DumperHelper::evaluationParameters(const WatchData &data,
// in rare cases we need more or less:
switch (td.type) {
case QAbstractItemType:
if (data.dumperFlags.isEmpty()) {
if (data.dumperFlags.isEmpty())
qWarning("Internal error: empty dumper state '%s'.", data.iname.constData());
} else {
else
inner = data.dumperFlags.mid(1);
}
break;
case QObjectSlotType:
case QObjectSignalType: {
@@ -1068,11 +1067,10 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
data1.type = data.type.left(data.type.size() - 4);
data1.iname = data.iname + '.' + QByteArray::number(i);
const QByteArray &addressSpec = list.at(i);
if (addressSpec.startsWith("0x")) {
if (addressSpec.startsWith("0x"))
data.setHexAddress(addressSpec);
} else {
else
data.dumperFlags = addressSpec; // Item model dumpers pull tricks
}
data1.exp = "((" + gdbQuoteTypes(data1.type) + "*)" + addressSpec + ')';
data1.setHasChildren(false);
data1.setValueNeeded();

View File

@@ -768,19 +768,18 @@ void GdbEngine::handleResponse(const QByteArray &buff)
break;
QByteArray resultClass = QByteArray::fromRawData(from, inner - from);
if (resultClass == "done") {
if (resultClass == "done")
response.resultClass = GdbResultDone;
} else if (resultClass == "running") {
else if (resultClass == "running")
response.resultClass = GdbResultRunning;
} else if (resultClass == "connected") {
else if (resultClass == "connected")
response.resultClass = GdbResultConnected;
} else if (resultClass == "error") {
else if (resultClass == "error")
response.resultClass = GdbResultError;
} else if (resultClass == "exit") {
else if (resultClass == "exit")
response.resultClass = GdbResultExit;
} else {
else
response.resultClass = GdbResultUnknown;
}
from = inner;
if (from != to) {
@@ -958,9 +957,8 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd)
showMessage(_("QUEUING COMMAND " + cmd.command));
m_commandsToRunOnTemporaryBreak.append(cmd);
if (state() == InferiorStopRequested) {
if (cmd.flags & LosesChild) {
if (cmd.flags & LosesChild)
notifyInferiorIll();
}
showMessage(_("CHILD ALREADY BEING INTERRUPTED. STILL HOPING."));
// Calling shutdown() here breaks all situations where two
// NeedsStop commands are issued in quick succession.
@@ -2177,11 +2175,10 @@ void GdbEngine::executeStep()
setTokenBarrier();
notifyInferiorRunRequested();
showStatusMessage(tr("Step requested..."), 5000);
if (isReverseDebugging()) {
if (isReverseDebugging())
postCommand("reverse-step", RunRequest, CB(handleExecuteStep));
} else {
else
postCommand("-exec-step", RunRequest, CB(handleExecuteStep));
}
}
void GdbEngine::handleExecuteStep(const GdbResponse &response)

View File

@@ -314,11 +314,10 @@ void GdbRemoteServerEngine::handleTargetQnx(const GdbResponse &response)
showMessage(msgAttachedToStoppedInferior(), StatusBar);
const qint64 pid = isMasterEngine() ? startParameters().attachPID : masterEngine()->startParameters().attachPID;
if (pid > -1) {
if (pid > -1)
postCommand("attach " + QByteArray::number(pid), CB(handleAttach));
} else {
else
handleInferiorPrepared();
}
} else {
// 16^error,msg="hd:5555: Connection timed out."
QString msg = msgConnectRemoteServerFailed(

View File

@@ -61,11 +61,10 @@ GdbTermEngine::GdbTermEngine(const DebuggerStartParameters &startParameters)
{
#ifdef Q_OS_WIN
// Windows up to xp needs a workaround for attaching to freshly started processes. see proc_stub_win
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) {
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
m_stubProc.setMode(Utils::ConsoleProcess::Suspend);
} else {
else
m_stubProc.setMode(Utils::ConsoleProcess::Debug);
}
#else
m_stubProc.setMode(Utils::ConsoleProcess::Debug);
m_stubProc.setSettings(Core::ICore::settings());

View File

@@ -493,9 +493,8 @@ void LldbEngineGuest::selectThread(qint64 token)
qDebug() << "\t\tsymbol: " << sym.IsValid() << sym.GetName() << sym.GetMangledName();
qDebug() << "\t\tfunction:" << func.IsValid();
qDebug() << "\t\ttu: " << tu.IsValid();
if (tu.IsValid()) {
if (tu.IsValid())
}
qDebug() << "\t\tmodule: " << module.IsValid() << module.GetFileSpec().IsValid()
<< module.GetFileSpec().GetFilename();
qDebug() << "\t\tblock: " << block.IsValid() << block.GetInlinedName();
@@ -676,9 +675,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev)
case 1:
switch (m_process->GetState()) {
case lldb::eStateRunning: // 5
if (!m_running) {
if (!m_running)
m_running = true;
}
notifyInferiorPid(m_process->GetProcessID());
switch (state()) {
case EngineRunRequested:
@@ -696,9 +694,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev)
}
break;
case lldb::eStateExited: // 9
if (m_running) {
if (m_running)
m_running = false;
}
switch (state()) {
case InferiorShutdownRequested:
notifyInferiorShutdownOk();
@@ -716,9 +713,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev)
}
break;
case lldb::eStateStopped: // 4
if (m_running) {
if (m_running)
m_running = false;
}
switch (state()) {
case InferiorShutdownRequested:
notifyInferiorShutdownOk();
@@ -735,9 +731,8 @@ void LldbEngineGuest::lldbEvent(lldb::SBEvent *ev)
}
break;
case lldb::eStateCrashed: // 7
if (m_running) {
if (m_running)
m_running = false;
}
switch (state()) {
case InferiorShutdownRequested:
notifyInferiorShutdownOk();

View File

@@ -97,9 +97,8 @@ qint64 SshIODevice::readData (char * data, qint64 maxSize)
return 0;
qint64 size = maxSize;
while (size > 0) {
if (!buckets.size()) {
if (!buckets.size())
return maxSize - size;
}
QByteArray &bucket = buckets.head();
if ((size + buckethead) >= bucket.size()) {
int d = bucket.size() - buckethead;

View File

@@ -65,11 +65,10 @@ void BaseQmlDebuggerClient::statusChanged(QmlDebug::ClientStatus status)
void BaseQmlDebuggerClient::sendMessage(const QByteArray &msg)
{
if (status() == QmlDebug::Enabled) {
if (status() == QmlDebug::Enabled)
QmlDebugClient::sendMessage(msg);
} else {
else
d->sendBuffer.append(msg);
}
}
void BaseQmlDebuggerClient::flushSendBuffer()

View File

@@ -95,9 +95,8 @@ void QmlAdapter::closeConnection()
if (m_connectionTimer.isActive()) {
m_connectionTimer.stop();
} else {
if (m_conn) {
if (m_conn)
m_conn->close();
}
}
}

View File

@@ -386,9 +386,8 @@ void QmlEngine::connectionEstablished()
{
attemptBreakpointSynchronization();
if (!watchHandler()->watcherNames().isEmpty()) {
if (!watchHandler()->watcherNames().isEmpty())
synchronizeWatchers();
}
connect(watchersModel(),SIGNAL(layoutChanged()),this,SLOT(synchronizeWatchers()));
if (state() == EngineRunRequested)
@@ -532,9 +531,8 @@ void QmlEngine::filterApplicationMessage(const QString &output, int /*channel*/)
void QmlEngine::showMessage(const QString &msg, int channel, int timeout) const
{
if (channel == AppOutput || channel == AppError) {
if (channel == AppOutput || channel == AppError)
const_cast<QmlEngine*>(this)->filterApplicationMessage(msg, channel);
}
DebuggerEngine::showMessage(msg, channel, timeout);
}
@@ -560,9 +558,8 @@ void QmlEngine::gotoLocation(const Location &location)
if (!editor) {
editor = Core::EditorManager::openEditorWithContents(QmlJSEditor::Constants::C_QMLJSEDITOR_ID,
&titlePattern);
if (editor) {
if (editor)
editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
}
updateEditor(editor, m_sourceDocuments.value(fileName));
}
@@ -648,9 +645,8 @@ void QmlEngine::shutdownInferior()
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->endSession();
if (isSlaveEngine()) {
if (isSlaveEngine())
resetLocation();
}
stopApplicationLauncher();
closeConnection();
@@ -692,9 +688,8 @@ void QmlEngine::setupEngine()
void QmlEngine::continueInferior()
{
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->continueInferior();
}
resetLocation();
notifyInferiorRunRequested();
notifyInferiorRunOk();
@@ -702,44 +697,39 @@ void QmlEngine::continueInferior()
void QmlEngine::interruptInferior()
{
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->interruptInferior();
}
notifyInferiorStopOk();
}
void QmlEngine::executeStep()
{
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->executeStep();
}
notifyInferiorRunRequested();
notifyInferiorRunOk();
}
void QmlEngine::executeStepI()
{
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->executeStepI();
}
notifyInferiorRunRequested();
notifyInferiorRunOk();
}
void QmlEngine::executeStepOut()
{
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->executeStepOut();
}
notifyInferiorRunRequested();
notifyInferiorRunOk();
}
void QmlEngine::executeNext()
{
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->executeNext();
}
notifyInferiorRunRequested();
notifyInferiorRunOk();
}
@@ -783,9 +773,8 @@ void QmlEngine::activateFrame(int index)
if (state() != InferiorStopOk && state() != InferiorUnrunnable)
return;
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->activateFrame(index);
}
gotoLocation(stackHandler()->frames().value(index));
}
@@ -854,9 +843,8 @@ void QmlEngine::removeBreakpoint(BreakpointModelId id)
}
}
if (handler->state(id) == BreakpointRemoveProceeding) {
if (handler->state(id) == BreakpointRemoveProceeding)
handler->notifyBreakpointRemoveOk(id);
}
}
void QmlEngine::changeBreakpoint(BreakpointModelId id)
@@ -874,9 +862,8 @@ void QmlEngine::changeBreakpoint(BreakpointModelId id)
}
}
if (handler->state(id) == BreakpointChangeProceeding) {
if (handler->state(id) == BreakpointChangeProceeding)
handler->notifyBreakpointChangeOk(id);
}
}
void QmlEngine::attemptBreakpointSynchronization()
@@ -941,9 +928,8 @@ bool QmlEngine::acceptsBreakpoint(BreakpointModelId id) const
//For now, the event breakpoint can be set after the activeDebuggerClient is known
//This is because the older client does not support BreakpointOnQmlSignalHandler
bool acceptBreakpoint = false;
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
acceptBreakpoint = m_adapter.activeDebuggerClient()->acceptsBreakpoint(id);
}
return acceptBreakpoint;
}
@@ -962,9 +948,8 @@ void QmlEngine::reloadModules()
void QmlEngine::reloadSourceFiles()
{
if (m_adapter.activeDebuggerClient()) {
if (m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->getSourceFiles();
}
}
void QmlEngine::requestModuleSymbols(const QString &moduleName)
@@ -1014,9 +999,8 @@ void QmlEngine::updateWatchData(const WatchData &data,
m_inspectorAdapter.agent()->updateWatchData(data);
} else {
if (!data.name.isEmpty() && m_adapter.activeDebuggerClient()) {
if (data.isValueNeeded()) {
if (data.isValueNeeded())
m_adapter.activeDebuggerClient()->updateWatchData(data);
}
if (data.isChildrenNeeded()
&& watchHandler()->isExpandedIName(data.iname)) {
m_adapter.activeDebuggerClient()->expandObject(data.iname, data.id);
@@ -1208,9 +1192,8 @@ void QmlEngine::appendDebugOutput(QtMsgType type, const QString &message,
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
{
if ((languages & QmlLanguage) && m_adapter.activeDebuggerClient()) {
if ((languages & QmlLanguage) && m_adapter.activeDebuggerClient())
m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
}
}
bool QmlEngine::evaluateScript(const QString &expression)

View File

@@ -1207,14 +1207,12 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
//do nothing, wait for next break
} else if (debugCommand == _(BACKTRACE)) {
if (success) {
if (success)
updateStack(resp.value(_(BODY)), resp.value(_(REFS)));
}
} else if (debugCommand == _(LOOKUP)) {
if (success) {
if (success)
expandLocalsAndWatchers(resp.value(_(BODY)), resp.value(_(REFS)));
}
} else if (debugCommand == _(EVALUATE)) {
int seq = resp.value(_("request_seq")).toInt();
@@ -1228,9 +1226,8 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
}
} else if (debugCommand == _(LISTBREAKPOINTS)) {
if (success) {
if (success)
updateBreakpoints(resp.value(_(BODY)));
}
} else if (debugCommand == _(SETBREAKPOINT)) {
// { "seq" : <number>,
@@ -1296,14 +1293,12 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
} else if (debugCommand == _(FRAME)) {
if (success) {
if (success)
setCurrentFrameDetails(resp.value(_(BODY)), resp.value(_(REFS)));
}
} else if (debugCommand == _(SCOPE)) {
if (success) {
if (success)
updateScope(resp.value(_(BODY)), resp.value(_(REFS)));
}
} else if (debugCommand == _(SCOPES)) {
} else if (debugCommand == _(SOURCE)) {
@@ -1478,9 +1473,8 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
d->backtrace();
}
if (d->engine->state() == InferiorStopOk) {
if (d->engine->state() == InferiorStopOk)
d->backtrace();
}
} else if (eventType == _("afterCompile")) {
//Currently break point relocation is disabled.

View File

@@ -299,11 +299,10 @@ void QScriptDebuggerClient::synchronizeBreakpoints()
str << cmd << " (";
bool first = true;
foreach (const JSAgentBreakpointData &bp, d->breakpoints) {
if (first) {
if (first)
first = false;
} else {
else
str << ", ";
}
str << '[' << bp.functionName << ", " << bp.fileUrl << ", " << bp.lineNumber << ']';
}
str << ')';

View File

@@ -784,11 +784,10 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
data1.name = it.name();
data.id = m_watchIdCounter++;
m_watchIdToScriptValue.insert(data.id, it.value());
if (watchHandler()->isExpandedIName(data1.iname)) {
if (watchHandler()->isExpandedIName(data1.iname))
data1.setChildrenNeeded();
} else {
else
data1.setChildrenUnneeded();
}
children.push_back(data1);
}
data.setHasChildren(!children.isEmpty());

View File

@@ -194,9 +194,8 @@ void formatWindowsException(unsigned long code, quint64 address,
break;
}
str << ", flags=0x" << flags;
if (flags == EXCEPTION_NONCONTINUABLE) {
if (flags == EXCEPTION_NONCONTINUABLE)
str << " (execution cannot be continued)";
}
str.setIntegerBase(10);
}

View File

@@ -134,11 +134,10 @@ QValidator::State IntegerValidator::validateEntry(const QString &s, int base, bo
if (bigInt)
return QValidator::Acceptable;
bool ok;
if (signedV) {
if (signedV)
s.toLongLong(&ok, base);
} else {
else
s.toULongLong(&ok, base);
}
return ok ? QValidator::Acceptable : QValidator::Intermediate;
}

View File

@@ -1157,11 +1157,10 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
case LocalsIndividualFormatRole: {
const int format = value.toInt();
if (format == -1) {
if (format == -1)
theIndividualFormats.remove(data.iname);
} else {
else
theIndividualFormats[data.iname] = format;
}
engine()->updateWatchData(data);
break;
}
@@ -1277,17 +1276,15 @@ static bool watchDataLessThan(const QByteArray &iname1, int sortId1,
return sortId1 < sortId2;
// Get positions of last part of iname 'local.this.i1" -> "i1"
int cmpPos1 = iname1.lastIndexOf('.');
if (cmpPos1 == -1) {
if (cmpPos1 == -1)
cmpPos1 = 0;
} else {
else
cmpPos1++;
}
int cmpPos2 = iname2.lastIndexOf('.');
if (cmpPos2 == -1) {
if (cmpPos2 == -1)
cmpPos2 = 0;
} else {
else
cmpPos2++;
}
// Are we looking at an array with numerical inames 'local.this.i1.0" ->
// Go by sort id.
if (cmpPos1 < iname1.size() && cmpPos2 < iname2.size()
@@ -1612,11 +1609,10 @@ void WatchHandler::watchExpression(const QString &exp, const QString &name)
// (address) if it can be found. Default to watchExpression().
void WatchHandler::watchVariable(const QString &exp)
{
if (const WatchData *localVariable = findCppLocalVariable(exp)) {
if (const WatchData *localVariable = findCppLocalVariable(exp))
watchExpression(QLatin1String(localVariable->exp), exp);
} else {
else
watchExpression(exp);
}
}
static void swapEndian(char *d, int nchar)
@@ -1657,11 +1653,10 @@ void WatchHandler::showSeparateWidget(QWidget *w)
m_separateWindow = new SeparateViewWidget(debuggerCore()->mainWindow());
int index = indexOf(m_separateWindow, w);
if (index != -1) {
if (index != -1)
m_separateWindow->setTabText(index, w->windowTitle());
} else {
else
index = m_separateWindow->addTab(w, w->windowTitle());
}
m_separateWindow->setCurrentIndex(index);
m_separateWindow->show();
m_separateWindow->raise();

View File

@@ -407,11 +407,10 @@ static void blockRecursion(const CPlusPlus::Overview &overview,
// the already seen occurrences in a hash.
const QString name = overview.prettyName(symbol->name());
SeenHash::iterator it = seenHash->find(name);
if (it == seenHash->end()) {
if (it == seenHash->end())
it = seenHash->insert(name, 0);
} else {
else
++(it.value());
}
// Is the declaration on or past the current line, that is,
// the variable not initialized.
if (symbol->line() >= line)

View File

@@ -444,11 +444,10 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
const RegisterMapConstIt regcEnd = regMap.constEnd();
for (RegisterMapConstIt it = regMap.constBegin(); it != regcEnd; ++it) {
const quint64 value = it.key();
if (value < start && start - value < 512) {
if (value < start && start - value < 512)
start = value;
} else if (value > end && value - end < 512) {
else if (value > end && value - end < 512)
end = value + 1;
}
}
// Indicate all variables.
const QColor background = parent->palette().color(QPalette::Normal, QPalette::Base);