From: Daniel Jasper Date: Fri, 20 Nov 2015 15:26:50 +0000 (+0000) Subject: clang-format: Don't use incorrect space in macro calls with operators. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aaf49845dc9a948d3a26d819017c275d7133ad88;p=clang clang-format: Don't use incorrect space in macro calls with operators. Before: MACRO(> ); After: MACRO(>); Not overly important, but easy and good for symmetry reasons :-). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253669 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 70ff7d8b9e..751b070cdf 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -2047,7 +2047,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, if ((Left.is(TT_TemplateOpener)) != (Right.is(TT_TemplateCloser))) return Style.SpacesInAngles; if ((Right.is(TT_BinaryOperator) && !Left.is(tok::l_paren)) || - Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr)) + (Left.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && + !Right.is(tok::r_paren))) return true; if (Left.is(TT_TemplateCloser) && Right.is(tok::l_paren) && Right.isNot(TT_FunctionTypeLParen)) diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 1c5e63b3e0..f0646c62e1 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2927,6 +2927,8 @@ TEST_F(FormatTest, MacroCallsWithoutTrailingSemicolon) { " EXCLUSIVE_LOCK_FUNCTION(mu_);\n" "};", getLLVMStyleWithColumns(40))); + + verifyFormat("MACRO(>)"); } TEST_F(FormatTest, LayoutMacroDefinitionsStatementsSpanningBlocks) {