[clang] [clang-format] Fix bugs in annotating arrows and square brackets (PR #160973)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 27 12:23:52 PDT 2025


================
@@ -4159,7 +4165,15 @@ TEST_F(TokenAnnotatorTest, LineCommentTrailingBackslash) {
   EXPECT_TOKEN(Tokens[1], tok::comment, TT_LineComment);
 }
 
-TEST_F(TokenAnnotatorTest, KeywordedFunctionLikeMacro) {
+TEST_F(TokenAnnotatorTest, ArrowAfterSubscript) {
+  auto Tokens =
+      annotate("return (getStructType()->getElements())[eIdx]->getName();");
+  ASSERT_EQ(Tokens.size(), 19u) << Tokens;
+  // Not TT_LambdaArrow.
+  EXPECT_TOKEN(Tokens[13], tok::arrow, TT_Unknown);
+}
+
+TEST_F(TokenAnnotatorTest, QtProperty) {
----------------
owenca wrote:

Sure. I've just renamed it in 17a66ea68d787e0938fdcc9535ca80029c88a210.

https://github.com/llvm/llvm-project/pull/160973


More information about the cfe-commits mailing list