[llvm] 1f9f68a - [BalancedPartitioning] Fix -Wdeprecated-this-capture

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 7 15:24:10 PST 2024


Author: Fangrui Song
Date: 2024-12-07T15:24:04-08:00
New Revision: 1f9f68a1cdbfaed813b35137a600bd76532f0c7e

URL: https://github.com/llvm/llvm-project/commit/1f9f68a1cdbfaed813b35137a600bd76532f0c7e
DIFF: https://github.com/llvm/llvm-project/commit/1f9f68a1cdbfaed813b35137a600bd76532f0c7e.diff

LOG: [BalancedPartitioning] Fix -Wdeprecated-this-capture

Added: 
    

Modified: 
    llvm/lib/Support/BalancedPartitioning.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/BalancedPartitioning.cpp b/llvm/lib/Support/BalancedPartitioning.cpp
index bc34b23f77cc8e..19977c57c08dba 100644
--- a/llvm/lib/Support/BalancedPartitioning.cpp
+++ b/llvm/lib/Support/BalancedPartitioning.cpp
@@ -31,7 +31,7 @@ void BalancedPartitioning::BPThreadPool::async(Func &&F) {
 #if LLVM_ENABLE_THREADS
   // This new thread could spawn more threads, so mark it as active
   ++NumActiveThreads;
-  TheThreadPool.async([=]() {
+  TheThreadPool.async([this, F]() {
     // Run the task
     F();
 
@@ -93,7 +93,7 @@ void BalancedPartitioning::run(std::vector<BPFunctionNode> &Nodes) const {
     Nodes[I].InputOrderIndex = I;
 
   auto NodesRange = llvm::make_range(Nodes.begin(), Nodes.end());
-  auto BisectTask = [=, &TP]() {
+  auto BisectTask = [this, NodesRange, &TP]() {
     bisect(NodesRange, /*RecDepth=*/0, /*RootBucket=*/1, /*Offset=*/0, TP);
   };
   if (TP) {
@@ -147,10 +147,11 @@ void BalancedPartitioning::bisect(const FunctionNodeRange Nodes,
   auto LeftNodes = llvm::make_range(Nodes.begin(), NodesMid);
   auto RightNodes = llvm::make_range(NodesMid, Nodes.end());
 
-  auto LeftRecTask = [=, &TP]() {
+  auto LeftRecTask = [this, LeftNodes, RecDepth, LeftBucket, Offset, &TP]() {
     bisect(LeftNodes, RecDepth + 1, LeftBucket, Offset, TP);
   };
-  auto RightRecTask = [=, &TP]() {
+  auto RightRecTask = [this, RightNodes, RecDepth, RightBucket, MidOffset,
+                       &TP]() {
     bisect(RightNodes, RecDepth + 1, RightBucket, MidOffset, TP);
   };
 


        


More information about the llvm-commits mailing list