diff options
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 1 | ||||
-rw-r--r-- | clang/unittests/Format/TokenAnnotatorTest.cpp | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index bfacfa3..83b4f1e7 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -2119,6 +2119,7 @@ bool UnwrappedLineParser::tryToParseLambda() { case tok::amp: case tok::star: case tok::kw_const: + case tok::kw_constexpr: case tok::comma: case tok::less: case tok::greater: diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index ed6fb41..bdbfca7 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -894,6 +894,13 @@ TEST_F(TokenAnnotatorTest, UnderstandsObjCBlock) { EXPECT_TOKEN(Tokens[9], tok::l_brace, TT_ObjCBlockLBrace); } +TEST_F(TokenAnnotatorTest, UnderstandsLambdas) { + auto Tokens = annotate("[]() constexpr {}"); + ASSERT_EQ(Tokens.size(), 8u) << Tokens; + EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare); + EXPECT_TOKEN(Tokens[5], tok::l_brace, TT_LambdaLBrace); +} + } // namespace } // namespace format } // namespace clang |