[clang] [clang-format] Improve function pointer CastRParen detection. (PR #126019)

via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 8 21:06:05 PST 2025


================
@@ -874,6 +874,11 @@ TEST_F(TokenAnnotatorTest, UnderstandsCasts) {
   EXPECT_TOKEN(Tokens[14], tok::r_paren, TT_CastRParen);
   EXPECT_TOKEN(Tokens[15], tok::amp, TT_UnaryOperator);
 
+  Tokens = annotate("func((foo(bar::*)(void))&a);");
----------------
rmarker wrote:

Ah, I was so focused on the behaviour from 19, that I didn't realise about the space after the return type.
Yeah, it seems like even with missing the annotation of the left paren clang-format 19, managed to get lucky with the right cast paren. With the extra fix in 20 revealing the underlying issue.
Nice work.

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


More information about the cfe-commits mailing list