From 88e15140ee54dab2b29940b514534df954e7da28 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 5 Mar 2019 19:27:24 +0000 Subject: [clang-format] Fix lambdas returning template specialization that contains operator in parameter A template specialization of a template foo can contain integer constants and a whole bunch of operators - e. g. foo< 1 ? !0 : (3+1)%4 > Inspired by https://reviews.llvm.org/D58922 Differential Revision: https://reviews.llvm.org/D58934 llvm-svn: 355434 --- clang/lib/Format/UnwrappedLineParser.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'clang/lib/Format/UnwrappedLineParser.cpp') diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 5e41564793e..4bc624db7dd 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1423,6 +1423,25 @@ bool UnwrappedLineParser::tryToParseLambda() { case tok::coloncolon: case tok::kw_mutable: case tok::kw_noexcept: + // Specialization of a template with an integer parameter can contain + // arithmetic, logical, comparison and ternary operators. + case tok::plus: + case tok::minus: + case tok::exclaim: + case tok::tilde: + case tok::slash: + case tok::percent: + case tok::lessless: + case tok::pipe: + case tok::pipepipe: + case tok::ampamp: + case tok::caret: + case tok::equalequal: + case tok::exclaimequal: + case tok::greaterequal: + case tok::lessequal: + case tok::question: + case tok::colon: nextToken(); break; case tok::arrow: -- cgit v1.2.3