[clang-tools-extra] [clang-tidy] Fix FP/FN in cppcoreguidelines-missing-std-forward (PR #178651)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 30 01:22:14 PST 2026


================
@@ -107,19 +107,21 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) {
 
   auto CapturedInLambda = hasDeclContext(cxxRecordDecl(
       isLambda(),
-      hasParent(lambdaExpr(forCallable(equalsBoundNode("func")),
-                           anyOf(CapturedInCaptureList, CapturedInBody)))));
+      hasAncestor(lambdaExpr(forCallable(equalsBoundNode("func")),
+                             anyOf(CapturedInCaptureList, CapturedInBody)))));
----------------
HerrCai0907 wrote:

In my option, we should track lambda level by level instead of directly finding the most outside lambda expr.

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


More information about the cfe-commits mailing list