https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/138504
Remove `CaptureInCopy` because function parameters captured by copy should not be considered forwarded. No functional changes because implicit captures are not added to capture list until the function is instantiated ([P0588R1](https://github.com/llvm/llvm-project/issues/61426) is not implemented currently), so that `CaptureInCopy` never matches anything. >From a972594f263865dc4d214591f6dc4f6f55b058db Mon Sep 17 00:00:00 2001 From: Yanzuo Liu <zw...@outlook.com> Date: Mon, 5 May 2025 19:02:06 +0800 Subject: [PATCH] Simplify check cppcoreguidelines-missing-std-forward --- .../clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp index bbb35228ce47f..2e8d4f7860021 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp @@ -98,13 +98,10 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) { allOf(hasCaptureDefaultKind(LambdaCaptureDefault::LCD_ByRef), unless(hasAnyCapture( capturesVar(varDecl(hasSameNameAsBoundNode("param")))))); - auto CaptureInCopy = allOf( - hasCaptureDefaultKind(LambdaCaptureDefault::LCD_ByCopy), HasRefToParm); auto CaptureByRefExplicit = hasAnyCapture( allOf(hasCaptureKind(LambdaCaptureKind::LCK_ByRef), RefToParm)); - auto CapturedInBody = - lambdaExpr(anyOf(CaptureInRef, CaptureInCopy, CaptureByRefExplicit)); + auto CapturedInBody = lambdaExpr(anyOf(CaptureInRef, CaptureByRefExplicit)); auto CapturedInCaptureList = hasAnyCapture(capturesVar( varDecl(hasInitializer(ignoringParenImpCasts(equalsBoundNode("call")))))); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits