diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -539,7 +539,7 @@ break; case tok::r_brace: if (OpeningBrace) { - if (!Style.RemoveBracesLLVM || + if (!Style.RemoveBracesLLVM || Line->InPPDirective || !OpeningBrace->isOneOf(TT_ControlStatementLBrace, TT_ElseLBrace)) { return false; } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -25803,6 +25803,13 @@ Style.ColumnLimit = 20; + verifyFormat("int i;\n" + "#define FOO(a, b) \\\n" + " while (a) { \\\n" + " b; \\\n" + " }", + Style); + verifyFormat("int ab = [](int i) {\n" " if (i > 0) {\n" " i = 12345678 -\n"