From c44b41e7c6fd444513ec8784f22fb299c5a950f6 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Fri, 18 Jun 2021 15:43:31 -0400 Subject: [PATCH] [SmartHolder] fix(clang-tidy): apply clang-tidy performance fixes (#3048) * Apply clang-tidy performance fixes * Fix bug introduced by double insert * Revert all non-smart-holder changes --- include/pybind11/detail/smart_holder_type_casters.h | 2 +- include/pybind11/trampoline_self_life_support.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/detail/smart_holder_type_casters.h b/include/pybind11/detail/smart_holder_type_casters.h index 15ab81c58..653332bf8 100644 --- a/include/pybind11/detail/smart_holder_type_casters.h +++ b/include/pybind11/detail/smart_holder_type_casters.h @@ -79,7 +79,7 @@ public: } // type_caster_generic::load_value END } - loaded_v_h = std::move(v_h); + loaded_v_h = v_h; loaded_v_h.type = typeinfo; } diff --git a/include/pybind11/trampoline_self_life_support.h b/include/pybind11/trampoline_self_life_support.h index 115f094ba..cdb1fb3ed 100644 --- a/include/pybind11/trampoline_self_life_support.h +++ b/include/pybind11/trampoline_self_life_support.h @@ -53,7 +53,7 @@ struct trampoline_self_life_support { // For the next two, the default implementations generate undefined behavior (ASAN failures // manually verified). The reason is that v_h needs to be kept default-initialized. trampoline_self_life_support(const trampoline_self_life_support &) {} - trampoline_self_life_support(trampoline_self_life_support &&) {} + trampoline_self_life_support(trampoline_self_life_support &&) noexcept {} // These should never be needed (please provide test cases if you think they are). trampoline_self_life_support &operator=(const trampoline_self_life_support &) = delete;