More fixes and improved clang-tidy checkers (#93213)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/93213
Approved by: https://github.com/Skylion007
This commit is contained in:
cyy
2023-02-01 14:44:13 +00:00
committed by PyTorch MergeBot
parent 679e869af0
commit 37f7c00a8a
37 changed files with 91 additions and 100 deletions

View File

@ -197,8 +197,8 @@ class class_ : public ::torch::detail::class_base {
GetterFunc getter_func,
SetterFunc setter_func,
std::string doc_string = "") {
torch::jit::Function* getter;
torch::jit::Function* setter;
torch::jit::Function* getter{};
torch::jit::Function* setter{};
auto wrapped_getter =
detail::wrap_func<CurClass, GetterFunc>(std::move(getter_func));
@ -218,7 +218,7 @@ class class_ : public ::torch::detail::class_base {
const std::string& name,
GetterFunc getter_func,
std::string doc_string = "") {
torch::jit::Function* getter;
torch::jit::Function* getter{};
auto wrapped_getter =
detail::wrap_func<CurClass, GetterFunc>(std::move(getter_func));
@ -321,7 +321,7 @@ class class_ : public ::torch::detail::class_base {
c10::guts::infer_function_traits_t<std::decay_t<SetStateFn>>;
using SetStateArg = typename c10::guts::typelist::head_t<
typename SetStateTraits::parameter_types>;
auto setstate_wrapper = [set_state = std::move(set_state)](
auto setstate_wrapper = [set_state = std::forward<SetStateFn>(set_state)](
c10::tagged_capsule<CurClass> self,
SetStateArg&& arg) {
c10::intrusive_ptr<CurClass> classObj =