Before:
switch (a) {
#if FOO
case 0: return 0; #endif
}
After:
switch (a) {
#if FOO
case 0: return 0;
#endif
}
This fixed llvm.org/PR21544.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222642
91177308-0d34-0410-b5e6-
96231b3b80d8
return 0;
unsigned NumStmts = 0;
unsigned Length = 0;
+ bool InPPDirective = I[0]->InPPDirective;
for (; NumStmts < 3; ++NumStmts) {
if (I + 1 + NumStmts == E)
break;
const AnnotatedLine *Line = I[1 + NumStmts];
+ if (Line->InPPDirective != InPPDirective)
+ break;
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,
"default: y = 1; break;\n"
"}",
Style);
+ verifyFormat("switch (a) {\n"
+ "#if FOO\n"
+ "case 0: return 0;\n"
+ "#endif\n"
+ "}",
+ Style);
verifyFormat("switch (a) {\n"
"case 1: {\n"
"}\n"