summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-11-21 12:36:25 +0000
committerDaniel Jasper <djasper@google.com>2014-11-21 12:36:25 +0000
commitd081e88e79430c6aa716942beb800a804cd52546 (patch)
treefecc7a6327450fbfada1a611c0806a2bae821132 /clang/lib/Format/Format.cpp
parent77e1a0ad1fa5c71eef1f0a223cdf73615207121b (diff)
downloadbcm5719-llvm-d081e88e79430c6aa716942beb800a804cd52546.tar.gz
bcm5719-llvm-d081e88e79430c6aa716942beb800a804cd52546.zip
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
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp2
1 files changed, 1 insertions, 1 deletions
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.
}
OpenPOWER on IntegriCloud