aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/watchhandler.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <[email protected]>2013-01-08 03:32:53 +0200
committerhjk <[email protected]>2013-01-08 10:48:18 +0100
commit29a93998df8405e8799ad23934a56cd99fb36403 (patch)
treec0e4a341efeef78fbe530a618caaa50254daad59 /src/plugins/debugger/watchhandler.cpp
parent73a2717bed511cffd0163195c314f7d919e5128b (diff)
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 <[email protected]>
Diffstat (limited to 'src/plugins/debugger/watchhandler.cpp')
-rw-r--r--src/plugins/debugger/watchhandler.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index f4056390208..5a274066a00 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -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();