summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2018-09-21 03:46:36 +0000
committerOwen Pan <owenpiano@gmail.com>2018-09-21 03:46:36 +0000
commit9da65a3ab009ca2f3b55d7a95d266554fec88d31 (patch)
tree89f87e5d4813830624b9a8c052e2bbe31438f32a /clang/lib
parent1dcce6c92602ef5f2ba69f7f0a2ad7316754216b (diff)
downloadbcm5719-llvm-9da65a3ab009ca2f3b55d7a95d266554fec88d31.tar.gz
bcm5719-llvm-9da65a3ab009ca2f3b55d7a95d266554fec88d31.zip
[clang-format] Do not merge short case labels if followed by a block.
Do not allow short case labels on a single line if the label is followed by a left brace. Fixes PR38926. llvm-svn: 342708
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/UnwrappedLineFormatter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 43d71504cac..76b495f453f 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -428,6 +428,8 @@ private:
if (Limit == 0 || I + 1 == E ||
I[1]->First->isOneOf(tok::kw_case, tok::kw_default))
return 0;
+ if (I[0]->Last->is(tok::l_brace) || I[1]->First->is(tok::l_brace))
+ return 0;
unsigned NumStmts = 0;
unsigned Length = 0;
bool EndsWithComment = false;
OpenPOWER on IntegriCloud