llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: Owen Pan (owenca) <details> <summary>Changes</summary> Uncovered in #<!-- -->124891. --- Full diff: https://github.com/llvm/llvm-project/pull/125019.diff 2 Files Affected: - (modified) clang/lib/Format/TokenAnnotator.cpp (+2-1) - (modified) clang/unittests/Format/TokenAnnotatorTest.cpp (+4) ``````````diff diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index a172df5291ae62..43e983f8d0979f 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1565,7 +1565,8 @@ class AnnotatingParser { if (const auto *Previous = Tok->Previous; !Previous || (!Previous->isAttribute() && - !Previous->isOneOf(TT_RequiresClause, TT_LeadingJavaAnnotation))) { + !Previous->isOneOf(TT_RequiresClause, TT_LeadingJavaAnnotation, + TT_BinaryOperator))) { Line.MightBeFunctionDecl = true; Tok->MightBeFunctionDeclParen = true; } diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index fc77e277947c56..7ad7e7fc529f79 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -1143,9 +1143,13 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) { EXPECT_TOKEN(Tokens[16], tok::pipepipe, TT_BinaryOperator); EXPECT_TOKEN(Tokens[21], tok::ampamp, TT_BinaryOperator); EXPECT_TOKEN(Tokens[27], tok::ampamp, TT_BinaryOperator); + // Not TT_TrailingAnnotation. + EXPECT_TOKEN(Tokens[28], tok::identifier, TT_Unknown); EXPECT_TOKEN(Tokens[31], tok::greater, TT_TemplateCloser); EXPECT_EQ(Tokens[31]->FakeRParens, 1u); EXPECT_TRUE(Tokens[31]->ClosesRequiresClause); + // Not TT_TrailingAnnotation. + EXPECT_TOKEN(Tokens[33], tok::identifier, TT_Unknown); Tokens = annotate("template<typename T>\n" `````````` </details> https://github.com/llvm/llvm-project/pull/125019 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits