diff options
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 3 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 843d8777188..65c0cabffc1 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -692,7 +692,8 @@ private: } else if (Current.isOneOf(tok::kw_return, tok::kw_throw)) { Contexts.back().IsExpression = true; } else if (Current.is(tok::l_paren) && !Line.MustBeDeclaration && - !Line.InPPDirective) { + !Line.InPPDirective && Current.Previous && + Current.Previous->isNot(tok::kw_decltype)) { bool ParametersOfFunctionType = Current.Previous && Current.Previous->is(tok::r_paren) && Current.Previous->MatchingParen && diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1380dd85a48..7db87cb3ce5 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -8432,6 +8432,9 @@ TEST_F(FormatTest, FormatsLambdas) { verifyFormat("SomeFunction([]() { // A cool function...\n" " return 43;\n" "});"); + verifyFormat("void f() {\n" + " SomeFunction([](decltype(x), A *a) {});\n" + "}"); // Lambdas with return types. verifyFormat("int c = []() -> int { return 2; }();\n"); |