forked from OSchip/llvm-project
Revert "[clang-format] Correctly recognize arrays in template parameter list."
This reverts commit 126b37a713
.
Regressed some ObjC patterns, see comments on https://reviews.llvm.org/D121584.
This commit is contained in:
parent
d00e8400e2
commit
be5c3ca7fb
|
@ -1940,11 +1940,6 @@ bool UnwrappedLineParser::tryToParseLambda() {
|
|||
if (!tryToParseLambdaIntroducer())
|
||||
return false;
|
||||
|
||||
// `[something] >` is not a lambda, but an array type in a template parameter
|
||||
// list.
|
||||
if (FormatTok->is(tok::greater))
|
||||
return false;
|
||||
|
||||
bool SeenArrow = false;
|
||||
bool InTemplateParameterList = false;
|
||||
|
||||
|
@ -3534,7 +3529,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
|
|||
// Don't try parsing a lambda if we had a closing parenthesis before,
|
||||
// it was probably a pointer to an array: int (*)[].
|
||||
if (!tryToParseLambda())
|
||||
continue;
|
||||
break;
|
||||
} else {
|
||||
parseSquare();
|
||||
continue;
|
||||
|
|
|
@ -98,20 +98,6 @@ TEST_F(TokenAnnotatorTest, UnderstandsStructs) {
|
|||
auto Tokens = annotate("struct S {};");
|
||||
EXPECT_EQ(Tokens.size(), 6u) << Tokens;
|
||||
EXPECT_TOKEN(Tokens[2], tok::l_brace, TT_StructLBrace);
|
||||
|
||||
Tokens = annotate("template <typename T> struct S<const T[N]> {};");
|
||||
EXPECT_EQ(Tokens.size(), 18u) << Tokens;
|
||||
EXPECT_TOKEN(Tokens[7], tok::less, TT_TemplateOpener);
|
||||
EXPECT_TOKEN(Tokens[10], tok::l_square, TT_ArraySubscriptLSquare);
|
||||
EXPECT_TOKEN(Tokens[13], tok::greater, TT_TemplateCloser);
|
||||
EXPECT_TOKEN(Tokens[14], tok::l_brace, TT_StructLBrace);
|
||||
|
||||
Tokens = annotate("template <typename T> struct S<T const[N]> {};");
|
||||
EXPECT_EQ(Tokens.size(), 18u) << Tokens;
|
||||
EXPECT_TOKEN(Tokens[7], tok::less, TT_TemplateOpener);
|
||||
EXPECT_TOKEN(Tokens[10], tok::l_square, TT_ArraySubscriptLSquare);
|
||||
EXPECT_TOKEN(Tokens[13], tok::greater, TT_TemplateCloser);
|
||||
EXPECT_TOKEN(Tokens[14], tok::l_brace, TT_StructLBrace);
|
||||
}
|
||||
|
||||
TEST_F(TokenAnnotatorTest, UnderstandsUnions) {
|
||||
|
|
Loading…
Reference in New Issue