aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2025-04-30 20:08:00 -0700
committerGitHub <noreply@github.com>2025-04-30 20:08:00 -0700
commite6d7f46ce9a6ffdfc206802131e0d79afb624b3f (patch)
tree6e3ade0b4e73f65d703080fcebdbae07328837ac /clang/unittests/Format
parent8effc8da292bfacb823a7e3c4134296da481fedc (diff)
downloadllvm-e6d7f46ce9a6ffdfc206802131e0d79afb624b3f.zip
llvm-e6d7f46ce9a6ffdfc206802131e0d79afb624b3f.tar.gz
llvm-e6d7f46ce9a6ffdfc206802131e0d79afb624b3f.tar.bz2
[clang-format] Correctly annotate user-defined conversion function call (#137914)
Fix #137770
Diffstat (limited to 'clang/unittests/Format')
-rw-r--r--clang/unittests/Format/TokenAnnotatorTest.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp
index 844f51f..124fb43 100644
--- a/clang/unittests/Format/TokenAnnotatorTest.cpp
+++ b/clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -392,9 +392,15 @@ TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmp) {
Tokens = annotate("return s.operator int *();");
ASSERT_EQ(Tokens.size(), 10u) << Tokens;
- EXPECT_TOKEN(Tokens[3], tok::kw_operator, TT_FunctionDeclarationName);
+ // Not TT_FunctionDeclarationName.
+ EXPECT_TOKEN(Tokens[3], tok::kw_operator, TT_Unknown);
EXPECT_TOKEN(Tokens[5], tok::star, TT_PointerOrReference);
- EXPECT_TOKEN(Tokens[6], tok::l_paren, TT_FunctionDeclarationLParen);
+ // Not TT_FunctionDeclarationLParen.
+ EXPECT_TOKEN(Tokens[6], tok::l_paren, TT_Unknown);
+
+ Tokens = annotate("B &b = x.operator B &();");
+ ASSERT_EQ(Tokens.size(), 13u) << Tokens;
+ EXPECT_TOKEN(Tokens[8], tok::amp, TT_PointerOrReference);
Tokens = annotate("int8_t *a = MacroCall(int8_t, width * height * length);");
ASSERT_EQ(Tokens.size(), 16u) << Tokens;