Skip to content

NFC: remove some instances of deprecated capture #154884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

j2kun
Copy link
Contributor

@j2kun j2kun commented Aug 22, 2025

 warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]

@j2kun j2kun requested a review from vzakhari August 22, 2025 04:39
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir llvm:support labels Aug 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 22, 2025

@llvm/pr-subscribers-mlir-sparse
@llvm/pr-subscribers-llvm-binary-utilities
@llvm/pr-subscribers-backend-amdgpu
@llvm/pr-subscribers-mlir-core

@llvm/pr-subscribers-llvm-support

Author: Jeremy Kun (j2kun)

Changes
 warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]

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

2 Files Affected:

  • (modified) llvm/lib/Support/Parallel.cpp (+1-1)
  • (modified) mlir/lib/Transforms/InlinerPass.cpp (+1-1)
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/mlir/lib/Transforms/InlinerPass.cpp b/mlir/lib/Transforms/InlinerPass.cpp
index 703e517d45374..45c2506964559 100644
--- a/mlir/lib/Transforms/InlinerPass.cpp
+++ b/mlir/lib/Transforms/InlinerPass.cpp
@@ -138,7 +138,7 @@ void InlinerPass::runOnOperation() {
   }
 
   // By default, assume that any inlining is profitable.
-  auto profitabilityCb = [=](const Inliner::ResolvedCall &call) {
+  auto profitabilityCb = [this, inliningThreshold](const Inliner::ResolvedCall &call) {
     return isProfitableToInline(call, inliningThreshold);
   };
 

Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Developer Policy and LLVM Discourse for more information.

Copy link

github-actions bot commented Aug 22, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@j2kun j2kun force-pushed the deprecated-capture branch 2 times, most recently from 75d11fb to 3f9d457 Compare August 22, 2025 04:55
@j2kun j2kun changed the title NFC: remove two instances of deprecated capture NFC: remove some instances of deprecated capture Aug 22, 2025
@j2kun j2kun force-pushed the deprecated-capture branch 3 times, most recently from 23ce23e to 5a86e84 Compare August 24, 2025 03:36
```
 warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture]
```
@j2kun j2kun force-pushed the deprecated-capture branch from 5a86e84 to 88e9055 Compare August 24, 2025 03:42
@j2kun j2kun enabled auto-merge (squash) August 24, 2025 04:45
@j2kun
Copy link
Contributor Author

j2kun commented Aug 24, 2025

Looks like the test failing is failing at head and unrelated to the change in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants