未验证 提交 a172e6cc 编写于 作者: G gouzil 提交者: GitHub

[clang-tidy][task 46] enable `modernize-avoid-bind` (#55895)

* [clang-tidy] modernize-avoid-bind

* rollback
上级 84445499
...@@ -165,7 +165,7 @@ bugprone-unused-raii, ...@@ -165,7 +165,7 @@ bugprone-unused-raii,
-hicpp-exception-baseclass, -hicpp-exception-baseclass,
-misc-unused-alias-decls, -misc-unused-alias-decls,
-misc-unused-using-decls, -misc-unused-using-decls,
-modernize-avoid-bind, modernize-avoid-bind,
-modernize-avoid-c-arrays, -modernize-avoid-c-arrays,
-modernize-deprecated-headers, -modernize-deprecated-headers,
-modernize-deprecated-ios-base-aliases, -modernize-deprecated-ios-base-aliases,
......
...@@ -88,8 +88,7 @@ void DistMultiTrainer::InitDumpEnv() { ...@@ -88,8 +88,7 @@ void DistMultiTrainer::InitDumpEnv() {
} }
} }
for (int i = 0; i < dump_thread_num_; i++) { for (int i = 0; i < dump_thread_num_; i++) {
dump_thread_.push_back( dump_thread_.push_back(std::thread([this, i] { DumpWork(i); }));
std::thread(std::bind(&TrainerBase::DumpWork, this, i)));
} }
} }
......
...@@ -107,8 +107,7 @@ void MultiTrainer::InitDumpEnv() { ...@@ -107,8 +107,7 @@ void MultiTrainer::InitDumpEnv() {
} }
} }
for (int i = 0; i < dump_thread_num_; i++) { for (int i = 0; i < dump_thread_num_; i++) {
dump_thread_.push_back( dump_thread_.push_back(std::thread([this, i] { DumpWork(i); }));
std::thread(std::bind(&TrainerBase::DumpWork, this, i)));
} }
} }
......
...@@ -350,7 +350,8 @@ class CompileTimeInferShapeContext : public InferShapeContext { ...@@ -350,7 +350,8 @@ class CompileTimeInferShapeContext : public InferShapeContext {
names.begin(), names.begin(),
names.end(), names.end(),
retv.begin(), retv.begin(),
std::bind(std::mem_fn(&CompileTimeInferShapeContext::GetVarType), std::bind(
std::mem_fn(&CompileTimeInferShapeContext::GetVarType), // NOLINT
this, this,
std::placeholders::_1)); std::placeholders::_1));
return retv; return retv;
......
...@@ -710,10 +710,11 @@ std::vector<proto::VarType::Type> RuntimeInferShapeContext::GetVarTypes( ...@@ -710,10 +710,11 @@ std::vector<proto::VarType::Type> RuntimeInferShapeContext::GetVarTypes(
const std::vector<Variable*>& vars) const { const std::vector<Variable*>& vars) const {
std::vector<proto::VarType::Type> retv; std::vector<proto::VarType::Type> retv;
retv.resize(vars.size()); retv.resize(vars.size());
std::transform(vars.begin(), std::transform(
vars.begin(),
vars.end(), vars.end(),
retv.begin(), retv.begin(),
std::bind(std::mem_fn(&RuntimeInferShapeContext::GetVarType), std::bind(std::mem_fn(&RuntimeInferShapeContext::GetVarType), // NOLINT
this, this,
std::placeholders::_1)); std::placeholders::_1));
return retv; return retv;
......
...@@ -55,8 +55,7 @@ ThreadPool::ThreadPool(int num_threads) : running_(true) { ...@@ -55,8 +55,7 @@ ThreadPool::ThreadPool(int num_threads) : running_(true) {
threads_.resize(num_threads); threads_.resize(num_threads);
for (auto& thread : threads_) { for (auto& thread : threads_) {
// TODO(Yancey1989): binding the thread on the specify CPU numberw // TODO(Yancey1989): binding the thread on the specify CPU numberw
thread = thread = std::make_unique<std::thread>([this] { ThreadPool::TaskLoop(); });
std::make_unique<std::thread>(std::bind(&ThreadPool::TaskLoop, this));
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册