summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodeformatter.cpp
diff options
context:
space:
mode:
authorlemelisk <bev.lemelisk@gmail.com>2014-10-14 19:32:24 +0400
committerlemelisk <bev.lemelisk@gmail.com>2014-10-15 09:42:19 +0200
commit62ba2b76f5e83d2b7e4b1d78fc4967a8aeca6262 (patch)
tree7cd25af07b0ce9a866ca0cfb18040bdf56c6c748 /src/plugins/cpptools/cppcodeformatter.cpp
parent11b30a22ed2082505153808d9edc11cbfa55e8bf (diff)
downloadqt-creator-62ba2b76f5e83d2b7e4b1d78fc4967a8aeca6262.tar.gz
CppTools: Small refactoring
Change-Id: I8975af5fe80724ead81a88a38289fe16fbb283fd Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index 87174c3b64..856089ad67 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -81,7 +81,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
m_tokenIndex = 1;
}
- for (; m_tokenIndex < m_tokens.size(); ) {
+ while (m_tokenIndex < m_tokens.size()) {
m_currentToken = tokenAt(m_tokenIndex);
const int kind = m_currentToken.kind();
@@ -460,7 +460,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
if (kind != T_CASE && kind != T_DEFAULT && tryStatement())
break;
switch (kind) {
- case T_RBRACE: leave(); continue;
+ case T_RBRACE:
case T_DEFAULT:
case T_CASE: leave(); continue;
} break;
@@ -1601,8 +1601,6 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i
} else if (type == case_cont) {
*indentDepth = state(i).savedIndentDepth;
break;
- } else if (type == topmost_intro) {
- break;
}
}
break;
@@ -1668,6 +1666,7 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i
if (m_styleSettings.indentControlFlowRelativeToSwitchLabels)
*indentDepth += m_tabSettings.m_indentSize;
}
+ break;
}
// ensure padding and indent are >= 0
*indentDepth = qMax(0, *indentDepth);