forked from OSchip/llvm-project
[clang-format] Fix the bug that joins template closer and > or >>
Also fixes a buggy test case. See PR42404 Differential Revision: https://reviews.llvm.org/D66332 llvm-svn: 369157
This commit is contained in:
parent
8341a847a2
commit
ac67414618
|
@ -919,6 +919,8 @@ private:
|
|||
case tok::greater:
|
||||
if (Style.Language != FormatStyle::LK_TextProto)
|
||||
Tok->Type = TT_BinaryOperator;
|
||||
if (Tok->Previous && Tok->Previous->is(TT_TemplateCloser))
|
||||
Tok->SpacesRequiredBefore = 1;
|
||||
break;
|
||||
case tok::kw_operator:
|
||||
if (Style.Language == FormatStyle::LK_TextProto ||
|
||||
|
|
|
@ -6618,7 +6618,10 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) {
|
|||
EXPECT_EQ("auto x = [] { A<A<A<A>>> a; };",
|
||||
format("auto x=[]{A<A<A<A> >> a;};", getGoogleStyle()));
|
||||
|
||||
verifyFormat("A<A>> a;", getChromiumStyle(FormatStyle::LK_Cpp));
|
||||
verifyFormat("A<A<int>> a;", getChromiumStyle(FormatStyle::LK_Cpp));
|
||||
|
||||
verifyFormat("int i = a<1> >> 1;");
|
||||
verifyFormat("bool b = a<1> > 1;");
|
||||
|
||||
verifyFormat("test >> a >> b;");
|
||||
verifyFormat("test << a >> b;");
|
||||
|
|
Loading…
Reference in New Issue