diff options
author | Owen Pan <owenpiano@gmail.com> | 2019-05-01 15:03:41 +0000 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2019-05-01 15:03:41 +0000 |
commit | 945890a63cbbfadc134acd3a1cc359d3b6deef43 (patch) | |
tree | 4b2e5bb70e7d7114ac71aeae21dac334c4fca1eb /clang/lib/Format/UnwrappedLineParser.cpp | |
parent | 6711b9699a66c9034a9ce25bea26f04298d6c644 (diff) | |
download | bcm5719-llvm-945890a63cbbfadc134acd3a1cc359d3b6deef43.tar.gz bcm5719-llvm-945890a63cbbfadc134acd3a1cc359d3b6deef43.zip |
[clang-format] Fix bug that misses some function-like macro usages
Fixes PR41483
Differential Revision: https://reviews.llvm.org/D61297
llvm-svn: 359687
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 64890d5333c..7acf33a9680 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1335,10 +1335,15 @@ void UnwrappedLineParser::parseStructuralElement() { // See if the following token should start a new unwrapped line. StringRef Text = FormatTok->TokenText; nextToken(); - if (Line->Tokens.size() == 1 && - // JS doesn't have macros, and within classes colons indicate fields, - // not labels. - Style.Language != FormatStyle::LK_JavaScript) { + + // JS doesn't have macros, and within classes colons indicate fields, not + // labels. + if (Style.Language == FormatStyle::LK_JavaScript) + break; + + TokenCount = Line->Tokens.size(); + if (TokenCount == 1 || + (TokenCount == 2 && Line->Tokens.front().Tok->is(tok::comment))) { if (FormatTok->Tok.is(tok::colon) && !Line->MustBeDeclaration) { Line->Tokens.begin()->Tok->MustBreakBefore = true; parseLabel(); |