diff options
author | Daniel Jasper <djasper@google.com> | 2015-09-21 09:50:01 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-09-21 09:50:01 +0000 |
commit | 368369b4536538ea1665135de3d2e446e40d8efc (patch) | |
tree | 8c4407bee8ced7e8c9c9ac13071e2440efb7548b /clang/lib/Format/UnwrappedLineFormatter.cpp | |
parent | f41a631b50f4c305da3b7033eb033cc129ead082 (diff) | |
download | bcm5719-llvm-368369b4536538ea1665135de3d2e446e40d8efc.tar.gz bcm5719-llvm-368369b4536538ea1665135de3d2e446e40d8efc.zip |
clang-format: Fix merging short case labels with comments.
This fixes llvm.org/PR24877.
Patch by Benjamin Daly, thank you!
llvm-svn: 248145
Diffstat (limited to 'clang/lib/Format/UnwrappedLineFormatter.cpp')
-rw-r--r-- | clang/lib/Format/UnwrappedLineFormatter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 20298d33947..7e1fc3b1dd5 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -305,7 +305,8 @@ private: if (Line->First->isOneOf(tok::kw_case, tok::kw_default, tok::r_brace)) break; if (Line->First->isOneOf(tok::kw_if, tok::kw_for, tok::kw_switch, - tok::kw_while, tok::comment)) + tok::kw_while, tok::comment) || + Line->Last->is(tok::comment)) return 0; Length += I[1 + NumStmts]->Last->TotalLength + 1; // 1 for the space. } |