summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-04-01 12:55:11 +0000
committerDaniel Jasper <djasper@google.com>2014-04-01 12:55:11 +0000
commite1e4319ab796b457ecd98ae27793d57ce1236f8f (patch)
tree0e3b9a353584a13ff17153ef0c069156c23f645b /clang/lib/Format/UnwrappedLineParser.cpp
parent1087f2980dd96ca4db2df1416020957cf0e3bfbc (diff)
downloadbcm5719-llvm-e1e4319ab796b457ecd98ae27793d57ce1236f8f.tar.gz
bcm5719-llvm-e1e4319ab796b457ecd98ae27793d57ce1236f8f.zip
clang-format: Support configurable list of foreach-macros.
This fixes llvm.org/PR17242. Patch by Brian Green, thank you! llvm-svn: 205307
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 58a581e97ed..96d815572fb 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud