diff options
author | Mitchell Balan <mitchell@stellarscience.com> | 2019-10-31 11:07:36 -0400 |
---|---|---|
committer | Mitchell Balan <mitchell@stellarscience.com> | 2019-10-31 11:08:05 -0400 |
commit | 8d7bd57526486cab9e3daba9934042c405d7946b (patch) | |
tree | 9bf6d47b55f292d5a45dbe3aa3c8423fa03ea34e /clang/lib/Format/TokenAnnotator.cpp | |
parent | 1725f2884175ca618d29b06e35f5c6ebd618053d (diff) | |
download | bcm5719-llvm-8d7bd57526486cab9e3daba9934042c405d7946b.tar.gz bcm5719-llvm-8d7bd57526486cab9e3daba9934042c405d7946b.zip |
[clang-format] Fix SpacesInSquareBrackets for Lambdas with Initial "&ref" Parameter
Summary:
This fixes an edge case in the `SpacesInSquareBrackets` option where an initial `&ref` lambda parameter is not padded with an initial space.
`int foo = [&bar ]() {}` is fixed to give `int foo = [ &bar ]() {}`
Reviewers: MyDeveloperDay, klimek, sammccall
Reviewed by: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang, #clang-format
Differential Revision: https://reviews.llvm.org/D69649
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 1ed35597d07..98b87c0f5a2 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2567,7 +2567,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return Left.Tok.isLiteral() || (Left.is(tok::identifier) && Left.Previous && Left.Previous->is(tok::kw_case)); if (Left.is(tok::l_square) && Right.is(tok::amp)) - return false; + return Style.SpacesInSquareBrackets; if (Right.is(TT_PointerOrReference)) { if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { if (!Left.MatchingParen) |