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

2025-02-08 Thread via cfe-commits
https://github.com/rmarker closed https://github.com/llvm/llvm-project/pull/126019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-02-08 Thread via cfe-commits
@@ -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

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

2025-02-07 Thread Owen Pan via cfe-commits
owenca wrote: See #126340. https://github.com/llvm/llvm-project/pull/126019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-02-07 Thread Owen Pan via cfe-commits
owenca wrote: The root cause is that the l_paren after the return type is not annotated. That's why the space between them is missing. https://github.com/llvm/llvm-project/pull/126019 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

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

2025-02-07 Thread Owen Pan via cfe-commits
@@ -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);"); owenca wrote: So `foo` i

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

2025-02-06 Thread Owen Pan via cfe-commits
@@ -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);"); owenca wrote: What's `fo

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

2025-02-05 Thread via cfe-commits
https://github.com/rmarker updated https://github.com/llvm/llvm-project/pull/126019 >From 7a9726372f24c7bc42c18b78e989dff3b48bc910 Mon Sep 17 00:00:00 2001 From: rmarker Date: Thu, 6 Feb 2025 17:54:25 +1030 Subject: [PATCH 1/2] Improve function pointer cast detection. --- clang/lib/Format/Tok

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

2025-02-05 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 52fc6ffcda0895c0c7b976ad1f5cb5a282b571d2 7a9726372f24c7bc42c18b78e989dff3b48bc910 --e

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

2025-02-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: None (rmarker) Changes Fixes #125012 --- Full diff: https://github.com/llvm/llvm-project/pull/126019.diff 2 Files Affected: - (modified) clang/lib/Format/TokenAnnotator.cpp (+15-2) - (modified) clang/unittests/Format/TokenAnnota

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

2025-02-05 Thread via cfe-commits
https://github.com/rmarker created https://github.com/llvm/llvm-project/pull/126019 Fixes #125012 >From 7a9726372f24c7bc42c18b78e989dff3b48bc910 Mon Sep 17 00:00:00 2001 From: rmarker Date: Thu, 6 Feb 2025 17:54:25 +1030 Subject: [PATCH] Improve function pointer cast detection. --- clang/lib