diff options
author | Daniel Jasper <djasper@google.com> | 2015-06-30 11:32:22 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-06-30 11:32:22 +0000 |
commit | 8378e8520c72c3f1ac96e14d85d4d6a0731aefa9 (patch) | |
tree | cc41a579795beebcf4850e82d9817a8aa8a2aea5 /lib/Format/UnwrappedLineParser.cpp | |
parent | c9c4216d2fb6307478254dbdc77405c931532298 (diff) | |
download | clang-8378e8520c72c3f1ac96e14d85d4d6a0731aefa9.tar.gz |
clang-format: Properly parse parenthesis in braced lists.
Among other things, this makes clang-format understand arbitrary blocks
embedded in them, such as:
SomeFunction({MACRO({ return output; }), b});
where MACRO could e.g. expand to a lambda.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241059 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 72652a7d0d..c58e6bccd9 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -1111,16 +1111,15 @@ bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons) { FormatTok->BlockKind = BK_BracedInit; parseBracedList(); break; - case tok::r_paren: + case tok::l_paren: + parseParens(); // JavaScript can just have free standing methods and getters/setters in // object literals. Detect them by a "{" following ")". if (Style.Language == FormatStyle::LK_JavaScript) { - nextToken(); if (FormatTok->is(tok::l_brace)) parseChildBlock(); break; } - nextToken(); break; case tok::r_brace: nextToken(); |