diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -485,7 +485,8 @@ // different LineFormatter would be used otherwise. if (Previous.ClosesTemplateDeclaration) return Style.AlwaysBreakTemplateDeclarations != FormatStyle::BTDS_No; - if (Previous.is(TT_FunctionAnnotationRParen)) + if (Previous.is(TT_FunctionAnnotationRParen) && + State.Line->Type != LT_PreprocessorDirective) return true; if (Previous.is(TT_LeadingJavaAnnotation) && Current.isNot(tok::l_paren) && Current.isNot(TT_LeadingJavaAnnotation)) 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 @@ -4804,6 +4804,15 @@ Style); } +TEST_F(FormatTest, FormatMacroWithZeroColumnWidth) { + FormatStyle ZeroColumn = getLLVMStyleWithColumns(0); + + // clang-format off + verifyFormat("#define A LOOOOOOOOOOOOOOOOOOONG() LOOOOOOOOOOOOOOOOOOONG()\n", + ZeroColumn); + // clang-format on +} + TEST_F(FormatTest, LayoutMacroDefinitionsStatementsSpanningBlocks) { verifyFormat("#define A \\\n" " f({ \\\n"