]> granicus.if.org Git - clang/commitdiff
clang-format: Support lambdas with namespace-qualified return types.
authorDaniel Jasper <djasper@google.com>
Tue, 11 Feb 2014 10:16:55 +0000 (10:16 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 11 Feb 2014 10:16:55 +0000 (10:16 +0000)
E.g.:
  Foo([]()->std::vector<int> { return { 2 }; }());

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201139 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTest.cpp

index ef55b68194020b8219433c86e8d5d0b63d856072..d7f9cf5d61a3890b92b7c0aab856713634bd5865 100644 (file)
@@ -782,6 +782,7 @@ bool UnwrappedLineParser::tryToParseLambda() {
     case tok::less:
     case tok::greater:
     case tok::identifier:
+    case tok::coloncolon:
     case tok::kw_mutable:
     case tok::arrow:
       nextToken();
index 3778401648d113c165daa8843ffb3be10e496e32..a79379963b1c636515f5aa0c7a577240126c5b36 100644 (file)
@@ -7956,6 +7956,7 @@ TEST_F(FormatTest, FormatsLambdas) {
   // Lambdas with return types.
   verifyFormat("int c = []()->int { return 2; }();\n");
   verifyFormat("int c = []()->vector<int> { return { 2 }; }();\n");
+  verifyFormat("Foo([]()->std::vector<int> { return { 2 }; }());");
 
   // Not lambdas.
   verifyFormat("constexpr char hello[]{ \"hello\" };");