From 7fa524b4b874529bff9b93b1783bcb29924c782f Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 20 Nov 2015 15:26:50 +0000 Subject: [PATCH] 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 :-). llvm-svn: 253669 --- clang/lib/Format/TokenAnnotator.cpp | 3 ++- clang/unittests/Format/FormatTest.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 70ff7d8b9e4d..751b070cdf92 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/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/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1c5e63b3e081..f0646c62e1ee 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/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) {