summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-11-14 08:22:46 +0000
committerDaniel Jasper <djasper@google.com>2014-11-14 08:22:46 +0000
commit61d81973c16131e3b9298c4931eb59bbe73dbed2 (patch)
treea8cca91f0e06412b46362bfa5824cd84a4e6b20e /clang/lib/Format/TokenAnnotator.cpp
parentf69b0585c1aa802a496737fa93443d4a215ae641 (diff)
downloadbcm5719-llvm-61d81973c16131e3b9298c4931eb59bbe73dbed2.tar.gz
bcm5719-llvm-61d81973c16131e3b9298c4931eb59bbe73dbed2.zip
clang-format: [Java] Improve formatting of generics.
Before: Function < F, ? extends T > function; After: Function<F, ? extends T> function; llvm-svn: 221976
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp14
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;
OpenPOWER on IntegriCloud