summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorMitchell Balan <mitchell@stellarscience.com>2019-10-31 11:07:36 -0400
committerMitchell Balan <mitchell@stellarscience.com>2019-10-31 11:08:05 -0400
commit8d7bd57526486cab9e3daba9934042c405d7946b (patch)
tree9bf6d47b55f292d5a45dbe3aa3c8423fa03ea34e /clang/lib/Format/TokenAnnotator.cpp
parent1725f2884175ca618d29b06e35f5c6ebd618053d (diff)
downloadbcm5719-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.cpp2
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)
OpenPOWER on IntegriCloud