diff options
| author | Daniel Jasper <djasper@google.com> | 2014-04-01 12:55:11 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-04-01 12:55:11 +0000 |
| commit | 33df7ef5ffbc4a6a0ef0dd0818d49c680d73102d (patch) | |
| tree | e4d9e8601957c7b9fc5df047acc7f5b8525d70b5 /lib/Format/UnwrappedLineParser.cpp | |
| parent | fcd13765fb9bc542ff4f470a16faa70f49d332a5 (diff) | |
| download | clang-33df7ef5ffbc4a6a0ef0dd0818d49c680d73102d.tar.gz clang-33df7ef5ffbc4a6a0ef0dd0818d49c680d73102d.tar.bz2 clang-33df7ef5ffbc4a6a0ef0dd0818d49c680d73102d.tar.xz | |
clang-format: Support configurable list of foreach-macros.
This fixes llvm.org/PR17242.
Patch by Brian Green, thank you!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205307 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
| -rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 58a581e97e..96d815572f 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -654,6 +654,12 @@ void UnwrappedLineParser::parseStructuralElement() { return; } } + break; + case tok::identifier: + if (FormatTok->IsForEachMacro) { + parseForOrWhileLoop(); + return; + } // In all other cases, parse the declaration. break; default: @@ -1041,8 +1047,9 @@ void UnwrappedLineParser::parseNamespace() { } void UnwrappedLineParser::parseForOrWhileLoop() { - assert((FormatTok->Tok.is(tok::kw_for) || FormatTok->Tok.is(tok::kw_while)) && - "'for' or 'while' expected"); + assert((FormatTok->Tok.is(tok::kw_for) || FormatTok->Tok.is(tok::kw_while) || + FormatTok->IsForEachMacro) && + "'for', 'while' or foreach macro expected"); nextToken(); if (FormatTok->Tok.is(tok::l_paren)) parseParens(); |
