summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-01-16 09:11:55 +0000
committerDaniel Jasper <djasper@google.com>2014-01-16 09:11:55 +0000
commitcb51cf409b45ddaa1bd16b1d88185b918c02bbdd (patch)
treee9034613fc88129b818a1a86c5b7c4c3bd572071 /clang/unittests/Format
parent157d911b42788d402b04a9cd7cbf45b0fd4541fb (diff)
downloadbcm5719-llvm-cb51cf409b45ddaa1bd16b1d88185b918c02bbdd.tar.gz
bcm5719-llvm-cb51cf409b45ddaa1bd16b1d88185b918c02bbdd.zip
clang-format: Enable formatting of lambdas with explicit return type.
So clang-format can now format: int c = []()->int { return 2; }(); int c = []()->vector<int> { return { 2 }; }(); llvm-svn: 199368
Diffstat (limited to 'clang/unittests/Format')
-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 32e70700fa3..910df459761 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -7890,6 +7890,10 @@ TEST_F(FormatTest, FormatsLambdas) {
" [&](int, int) { return 1; });\n"
"}\n");
+ // Lambdas with return types.
+ verifyFormat("int c = []()->int { return 2; }();\n");
+ verifyFormat("int c = []()->vector<int> { return { 2 }; }();\n");
+
// Not lambdas.
verifyFormat("constexpr char hello[]{ \"hello\" };");
verifyFormat("double &operator[](int i) { return 0; }\n"
OpenPOWER on IntegriCloud