[Mlir-commits] [llvm] [mlir] NFC: remove two instances of deprecated capture (PR #154884)

Jeremy Kun llvmlistbot at llvm.org
Thu Aug 21 21:55:39 PDT 2025


https://github.com/j2kun updated https://github.com/llvm/llvm-project/pull/154884

>From 3f9d457cb5509add91b290eb221bfa96617e4a0c Mon Sep 17 00:00:00 2001
From: Jeremy Kun <j2kun at users.noreply.github.com>
Date: Thu, 21 Aug 2025 21:38:49 -0700
Subject: [PATCH] NFC: remove some instances of deprecated capture

```
 warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
```
---
 llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp           | 7 ++++---
 llvm/lib/Support/Parallel.cpp                              | 2 +-
 llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp       | 2 +-
 .../lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp | 2 +-
 mlir/lib/Transforms/InlinerPass.cpp                        | 7 ++++---
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp b/llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
index 33eed07c46292..8737dc0fc7459 100644
--- a/llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
+++ b/llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
@@ -77,9 +77,10 @@ bool MetadataVerifier::verifyScalarEntry(
     msgpack::MapDocNode &MapNode, StringRef Key, bool Required,
     msgpack::Type SKind,
     function_ref<bool(msgpack::DocNode &)> verifyValue) {
-  return verifyEntry(MapNode, Key, Required, [=](msgpack::DocNode &Node) {
-    return verifyScalar(Node, SKind, verifyValue);
-  });
+  return verifyEntry(MapNode, Key, Required,
+                     [this, SKind, verifyValue](msgpack::DocNode &Node) {
+                       return verifyScalar(Node, SKind, verifyValue);
+                     });
 }
 
 bool MetadataVerifier::verifyIntegerEntry(msgpack::MapDocNode &MapNode,
diff --git a/llvm/lib/Support/Parallel.cpp b/llvm/lib/Support/Parallel.cpp
index 2ba02b73dd8f1..3ac6fc74fd3e0 100644
--- a/llvm/lib/Support/Parallel.cpp
+++ b/llvm/lib/Support/Parallel.cpp
@@ -60,7 +60,7 @@ class ThreadPoolExecutor : public Executor {
     auto &Thread0 = Threads[0];
     Thread0 = std::thread([this, S] {
       for (unsigned I = 1; I < ThreadCount; ++I) {
-        Threads.emplace_back([=] { work(S, I); });
+        Threads.emplace_back([this, S, I] { work(S, I); });
         if (Stop)
           break;
       }
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index 78a2678808eee..7df390ff204da 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -1007,7 +1007,7 @@ class AMDGPUOperand : public MCParsedAsmOperand {
   bool isEndpgm() const;
 
   auto getPredicate(std::function<bool(const AMDGPUOperand &Op)> P) const {
-    return [=](){ return P(*this); };
+    return [this, P](){ return P(*this); };
   }
 
   StringRef getToken() const {
diff --git a/mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp b/mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp
index 56b435c57d30a..d1ffaeac7489a 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/Detail/DimLvlMapParser.cpp
@@ -231,7 +231,7 @@ ParseResult DimLvlMapParser::parseLvlSpecList() {
   const auto loc = parser.getCurrentLocation();
   const auto res = parser.parseCommaSeparatedList(
       mlir::OpAsmParser::Delimiter::Paren,
-      [=]() -> ParseResult { return parseLvlSpec(requireLvlVarBinding); },
+      [this, requireLvlVarBinding]() -> ParseResult { return parseLvlSpec(requireLvlVarBinding); },
       " in level-specifier list");
   FAILURE_IF_FAILED(res)
   const auto specLvlRank = lvlSpecs.size();
diff --git a/mlir/lib/Transforms/InlinerPass.cpp b/mlir/lib/Transforms/InlinerPass.cpp
index 703e517d45374..4a897f92c9828 100644
--- a/mlir/lib/Transforms/InlinerPass.cpp
+++ b/mlir/lib/Transforms/InlinerPass.cpp
@@ -138,9 +138,10 @@ void InlinerPass::runOnOperation() {
   }
 
   // By default, assume that any inlining is profitable.
-  auto profitabilityCb = [=](const Inliner::ResolvedCall &call) {
-    return isProfitableToInline(call, inliningThreshold);
-  };
+  auto profitabilityCb =
+      [this, inliningThreshold](const Inliner::ResolvedCall &call) {
+        return isProfitableToInline(call, inliningThreshold);
+      };
 
   // Get an instance of the inliner.
   Inliner inliner(op, cg, *this, getAnalysisManager(), runPipelineHelper,



More information about the Mlir-commits mailing list