Fix indentation for case: // comment.
Before:
switch (x) {
case 1:
// Do amazing stuff
{
g();
f();
}
}
After:
switch (x) {
case 1:
// Do amazing stuff
{
g();
f();
}
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177420 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index cdd7775..a438a53 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -576,7 +576,7 @@
unsigned OldLineLevel = Line->Level;
if (Line->Level > 0)
--Line->Level;
- if (FormatTok.Tok.is(tok::l_brace)) {
+ if (CommentsBeforeNextToken.empty() && FormatTok.Tok.is(tok::l_brace)) {
parseBlock(/*MustBeDeclaration=*/ false);
if (FormatTok.Tok.is(tok::kw_break))
parseStructuralElement(); // "break;" after "}" goes on the same line.