From 301f304949ad3e5cd3e56f1999f1c4abae6d6ead Mon Sep 17 00:00:00 2001 From: Andrew Ng Date: Tue, 26 Feb 2019 14:34:49 +0000 Subject: [clang-format] SpaceBeforeParens for lambda expressions Add support for lambda expressions to the SpaceBeforeParens formatting option. Differential Revision: https://reviews.llvm.org/D58241 llvm-svn: 354880 --- clang/lib/Format/TokenAnnotator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib/Format/TokenAnnotator.cpp') diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index c7ddbf5926a..9f4e1802a88 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2547,7 +2547,9 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, (!Left.Previous || Left.Previous->isNot(tok::period))))) || (Style.SpaceBeforeParens == FormatStyle::SBPO_Always && (Left.is(tok::identifier) || Left.isFunctionLikeKeyword() || - Left.is(tok::r_paren)) && + Left.is(tok::r_paren) || + (Left.is(tok::r_square) && Left.MatchingParen && + Left.MatchingParen->is(TT_LambdaLSquare))) && Line.Type != LT_PreprocessorDirective); } if (Left.is(tok::at) && Right.Tok.getObjCKeywordID() != tok::objc_not_keyword) -- cgit v1.2.3