diff options
-rw-r--r-- | clang/lib/Format/FormatTokenLexer.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 4 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTestJava.cpp | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index 6caf9716b59..8fb3d84ea5c 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -96,12 +96,8 @@ void FormatTokenLexer::tryMergePreviousTokens() { } if (Style.Language == FormatStyle::LK_Java) { - static const tok::TokenKind JavaRightLogicalShift[] = { - tok::greater, tok::greater, tok::greater}; static const tok::TokenKind JavaRightLogicalShiftAssign[] = { tok::greater, tok::greater, tok::greaterequal}; - if (tryMergeTokens(JavaRightLogicalShift, TT_BinaryOperator)) - return; if (tryMergeTokens(JavaRightLogicalShiftAssign, TT_BinaryOperator)) return; } diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index c321eadf354..a49cbaab5f4 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -47,7 +47,7 @@ private: if (NonTemplateLess.count(CurrentToken->Previous)) return false; - const FormatToken &Previous = *CurrentToken->Previous; + const FormatToken &Previous = *CurrentToken->Previous; // The '<'. if (Previous.Previous) { if (Previous.Previous->Tok.isLiteral()) return false; @@ -2323,7 +2323,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, if (Left.is(TT_TemplateCloser) && Left.MatchingParen && Left.MatchingParen->Previous && Left.MatchingParen->Previous->is(tok::period)) - // A.<B>DoSomething(); + // A.<B<C<...>>>DoSomething(); return false; if (Left.is(TT_TemplateCloser) && Right.is(tok::l_square)) return false; diff --git a/clang/unittests/Format/FormatTestJava.cpp b/clang/unittests/Format/FormatTestJava.cpp index 408fdaa85ad..2f376f765d6 100644 --- a/clang/unittests/Format/FormatTestJava.cpp +++ b/clang/unittests/Format/FormatTestJava.cpp @@ -333,6 +333,11 @@ TEST_F(FormatTestJava, Generics) { verifyFormat("Iterable<? extends SomeObject> a;"); verifyFormat("A.<B>doSomething();"); + verifyFormat("A.<B<C>>doSomething();"); + verifyFormat("A.<B<C<D>>>doSomething();"); + verifyFormat("A.<B<C<D<E>>>>doSomething();"); + + verifyFormat("OrderedPair<String, List<Box<Integer>>> p = null;"); verifyFormat("@Override\n" "public Map<String, ?> getAll() {}"); |