summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-13 16:09:21 +0000
committerDaniel Jasper <djasper@google.com>2015-05-13 16:09:21 +0000
commitc4144ea4186809e6cea44b97a3e5f60a0b2bf07a (patch)
tree4d62cf566d5ac329ee75ac02f8dfe83fa0b2b8fb /clang/unittests/Format/FormatTest.cpp
parentdf7fd46c4a4832a133c498b526ff3db9c61e5742 (diff)
downloadbcm5719-llvm-c4144ea4186809e6cea44b97a3e5f60a0b2bf07a.tar.gz
bcm5719-llvm-c4144ea4186809e6cea44b97a3e5f60a0b2bf07a.zip
clang-format: Improve nested block / lambda indentation when wrapping
before binary/ternary operators. Basically, it doesn't seem right to indent a nested block aligned to a binary or ternary operator. Before: int i = aaaaaa ? 1 // : [] { return 2; // }(); llvm::errs() << "number of twos is " << std::count_if(v.begin(), v.end(), [](int x) { return x == 2; // force break }); After: int i = aaaaaa ? 1 // : [] { return 2; // }(); llvm::errs() << "number of twos is " << std::count_if(v.begin(), v.end(), [](int x) { return x == 2; // force break }); llvm-svn: 237263
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c44708fbf6c..d5614b84305 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -9992,6 +9992,14 @@ TEST_F(FormatTest, FormatsLambdas) {
verifyFormat("auto my_lambda = [](const string &some_parameter) {\n"
" return some_parameter.size();\n"
"};");
+ verifyFormat("int i = aaaaaa ? 1 //\n"
+ " : [] {\n"
+ " return 2; //\n"
+ " }();");
+ verifyFormat("llvm::errs() << \"number of twos is \"\n"
+ " << std::count_if(v.begin(), v.end(), [](int x) {\n"
+ " return x == 2; // force break\n"
+ " });");
// Lambdas with return types.
verifyFormat("int c = []() -> int { return 2; }();\n");
OpenPOWER on IntegriCloud