From d081e88e79430c6aa716942beb800a804cd52546 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 21 Nov 2014 12:36:25 +0000 Subject: clang-format: Handle comments in short case labels. With AllowShortCaseLabelsOnASingleLine set to true: This gets now left unchanged: case 1: // comment return; Whereas before it was changed into: case 1: // comment return; This fixes llvm.org/PR21630. llvm-svn: 222529 --- clang/lib/Format/Format.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Format/Format.cpp') diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 729ca97aabe..b96c17abbc0 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -750,7 +750,7 @@ 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::kw_while, tok::comment)) return 0; Length += I[1 + NumStmts]->Last->TotalLength + 1; // 1 for the space. } -- cgit v1.2.3