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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/136728.diff


1 Files Affected:

- (modified) clang/lib/Basic/DiagnosticIDs.cpp (+1-1) 


``````````diff
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);
   }
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list