summaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-08-07 19:20:45 +0000
committerManuel Klimek <klimek@google.com>2013-08-07 19:20:45 +0000
commitd3a247cc4e136af6b71dc5968ca6190e6c68f4c5 (patch)
tree6a3a70b7ae1200d53937528d9a3cc0d20e46b749 /lib/Format/Format.cpp
parentb82f77fbe320a497f0b60d241c59b651b3ce15ca (diff)
downloadclang-d3a247cc4e136af6b71dc5968ca6190e6c68f4c5.tar.gz
clang-d3a247cc4e136af6b71dc5968ca6190e6c68f4c5.tar.bz2
clang-d3a247cc4e136af6b71dc5968ca6190e6c68f4c5.tar.xz
Fixes a couple of bugs with the Allman brace breaking.
In particular, left braces after an enum declaration now occur on their own line. Further, when short ifs/whiles are allowed these no longer cause the left brace to be on the same line as the if/while when a brace is included. Patch by Thomas Gibson-Robinson. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187901 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 140bda2193..255f5142f0 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1710,6 +1710,9 @@ private:
unsigned Limit) {
if (Limit == 0)
return;
+ if (Style.BreakBeforeBraces == FormatStyle::BS_Allman &&
+ (I + 1)->First->is(tok::l_brace))
+ return;
if ((I + 1)->InPPDirective != I->InPPDirective ||
((I + 1)->InPPDirective && (I + 1)->First->HasUnescapedNewline))
return;