diff options
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 8ec8f58d147..f926beb1066 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -63,11 +63,13 @@ private: next(); return true; } - if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace, - tok::colon)) - return false; if (CurrentToken->is(tok::question) && - Style.Language != FormatStyle::LK_Java) + Style.Language == FormatStyle::LK_Java) { + next(); + continue; + } + if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace, + tok::colon, tok::question)) return false; // If a && or || is found and interpreted as a binary operator, this set // of angles is likely part of something like "a < b && c > d". If the @@ -367,10 +369,6 @@ private: } bool parseConditional() { - if (Style.Language == FormatStyle::LK_Java && - CurrentToken->isOneOf(tok::comma, tok::greater)) - return true; // This is a generic "?". - while (CurrentToken) { if (CurrentToken->is(tok::colon)) { CurrentToken->Type = TT_ConditionalExpr; |