[clang] [Clang] Remove use after move of lambda (PR #136728)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 22 10:03:20 PDT 2025


https://github.com/shafik created https://github.com/llvm/llvm-project/pull/136728

Static analysis flagged this use after move. It is undefined behavior and I don't see any possible performance gains here to attempt to do anything else but simply remove it.

>From 693a1f38d9a28ef515ccb738bee62e7ea41606b4 Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Tue, 22 Apr 2025 09:55:24 -0700
Subject: [PATCH] [Clang] Remove use after move of lambda

Static analysis flagged this use after move. It is undefined behavior and
I don't see any possible performance gains here to attempt to do anything else
but simply remove it.
---
 clang/lib/Basic/DiagnosticIDs.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp
index d5928431f41a2..e2d940c0d39e9 100644
--- a/clang/lib/Basic/DiagnosticIDs.cpp
+++ b/clang/lib/Basic/DiagnosticIDs.cpp
@@ -705,7 +705,7 @@ static void forEachSubGroupImpl(const WarningOption *Group, Func func) {
   for (const int16_t *SubGroups = DiagSubGroups + Group->SubGroups;
        *SubGroups != -1; ++SubGroups) {
     func(static_cast<size_t>(*SubGroups));
-    forEachSubGroupImpl(&OptionTable[*SubGroups], std::move(func));
+    forEachSubGroupImpl(&OptionTable[*SubGroups], func);
   }
 }
 



More information about the cfe-commits mailing list