From 368369b4536538ea1665135de3d2e446e40d8efc Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 21 Sep 2015 09:50:01 +0000 Subject: clang-format: Fix merging short case labels with comments. This fixes llvm.org/PR24877. Patch by Benjamin Daly, thank you! llvm-svn: 248145 --- clang/lib/Format/UnwrappedLineFormatter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Format') 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. } -- cgit v1.2.3