summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.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/unittests/Format/FormatTest.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/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp4
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) {
OpenPOWER on IntegriCloud