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/unittests/Format/FormatTest.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/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index e0ebef1f7ce..ea03ee1c3cc 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -10572,6 +10572,10 @@ TEST_F(FormatTest, ConfigurableSpacesInSquareBrackets) { // Lambdas. verifyFormat("int c = []() -> int { return 2; }();\n", Spaces); verifyFormat("return [ i, args... ] {};", Spaces); + verifyFormat("int foo = [ &bar ]() {};", Spaces); + verifyFormat("int foo = [ = ]() {};", Spaces); + verifyFormat("int foo = [ =, &bar ]() {};", Spaces); + verifyFormat("int foo = [ &bar, = ]() {};", Spaces); } TEST_F(FormatTest, ConfigurableSpaceBeforeAssignmentOperators) { |