diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-09-13 13:18:55 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-09-13 13:18:55 +0000 |
commit | 41f4d68a50beeaeb821baa29b5591a7146b98b05 (patch) | |
tree | 8febfa2728645ea0d7e8fbe20857fd8f2223a5b0 /clang/unittests/Format | |
parent | ab9acda026e4beee458a953f02fd8c342c89ad56 (diff) | |
download | bcm5719-llvm-41f4d68a50beeaeb821baa29b5591a7146b98b05.tar.gz bcm5719-llvm-41f4d68a50beeaeb821baa29b5591a7146b98b05.zip |
clang-format: Add support for formatting (some) lambdas with explicit template parameters.
This patch makes cases work where the lambda's template list doesn't
contain any of + - ! ~ / % << | || && ^ == != >= <= ? : true false
(see added FIXME).
Ports r359967 to clang-format.
Differential Revision: https://reviews.llvm.org/D67246
llvm-svn: 371854
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index f1a1160fa14..b1fcd39a49a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -12923,6 +12923,10 @@ TEST_F(FormatTest, FormatsLambdas) { " return 1; //\n" "};"); + // Lambdas with explicit template argument lists. + verifyFormat( + "auto L = []<template <typename> class T, class U>(T<U> &&a) {};\n"); + // Multiple lambdas in the same parentheses change indentation rules. These // lambdas are forced to start on new lines. verifyFormat("SomeFunction(\n" @@ -12940,8 +12944,8 @@ TEST_F(FormatTest, FormatsLambdas) { " },\n" " 1);\n"); - // A multi-line lambda passed as arg1 forces arg0 to be pushed out, just like the arg0 - // case above. + // A multi-line lambda passed as arg1 forces arg0 to be pushed out, just like + // the arg0 case above. auto Style = getGoogleStyle(); Style.BinPackArguments = false; verifyFormat("SomeFunction(\n" |