summaryrefslogtreecommitdiffstats
path: root/clang/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
commita027f306a62626a48104096d53c538503ef0e10a (patch)
treebfbc9061f81b3d82817bab7ec3b1cb5547763d9f /clang/lib/Format/Format.cpp
parent89c862f29868fefd9d49fec214df52250fb82759 (diff)
downloadbcm5719-llvm-a027f306a62626a48104096d53c538503ef0e10a.tar.gz
bcm5719-llvm-a027f306a62626a48104096d53c538503ef0e10a.zip
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. llvm-svn: 187901
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 140bda21938..255f5142f07 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud