diff options
author | Jan Korous <jkorous@apple.com> | 2019-03-05 19:27:24 +0000 |
---|---|---|
committer | Jan Korous <jkorous@apple.com> | 2019-03-05 19:27:24 +0000 |
commit | 88e15140ee54dab2b29940b514534df954e7da28 (patch) | |
tree | d25ae1f13a3a9e2452b530846bf5650010cef94f /clang/lib | |
parent | 57fd733140f6b90f395aec654f8dc69cb0e2e233 (diff) | |
download | bcm5719-llvm-88e15140ee54dab2b29940b514534df954e7da28.tar.gz bcm5719-llvm-88e15140ee54dab2b29940b514534df954e7da28.zip |
[clang-format] Fix lambdas returning template specialization that contains operator in parameter
A template specialization of a template foo<int N> 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
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
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: |