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 }; }());

llvm-svn: 201139

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

index ef55b68..d7f9cf5 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 3778401..a793799 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\" };");