diff options
author | Daniel Jasper <djasper@google.com> | 2017-06-19 07:40:49 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2017-06-19 07:40:49 +0000 |
commit | 6a7d5a7a22a6522e0bfb7e60b3a15acb2eed2f60 (patch) | |
tree | e31da3c516b5de6dabbba11f72a2b56b23beb387 /clang/lib/Format/UnwrappedLineParser.cpp | |
parent | 271dd0603e4ddb63e1c7cc140459cb42fe13a2ac (diff) | |
download | bcm5719-llvm-6a7d5a7a22a6522e0bfb7e60b3a15acb2eed2f60.tar.gz bcm5719-llvm-6a7d5a7a22a6522e0bfb7e60b3a15acb2eed2f60.zip |
clang-format: Handle "if constexpr".
c++1z adds the following constructions to the language:
if constexpr (cond)
statement1;
else if constexpr (cond)
statement2;
else if constexpr (cond)
statement3;
else
statement4;
A first version of this was proposed in reviews.llvm.org/D26953 by
Francis Visoiu Mistrih, but never commited. This patch additionally
fixes the behavior when allowing short if statements on a single line
and was authored by Jacob Bandes-Storch. Thank you to both authors.
llvm-svn: 305666
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 27436dda67a..f7678bb6b2a 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1516,6 +1516,8 @@ void UnwrappedLineParser::parseSquare() { void UnwrappedLineParser::parseIfThenElse() { assert(FormatTok->Tok.is(tok::kw_if) && "'if' expected"); nextToken(); + if (FormatTok->Tok.is(tok::kw_constexpr)) + nextToken(); if (FormatTok->Tok.is(tok::l_paren)) parseParens(); bool NeedsUnwrappedLine = false; |