Revert "Enable cppcoreguidelines-special-member-functions (#139132)"

This reverts commit a9b4989c726a29b4b89c64282e32b9e4fc0b7d68.

Reverted https://github.com/pytorch/pytorch/pull/139132 on behalf of https://github.com/ZainRizvi due to Sorry but this fails on trunk. See inductor/test_mkldnn_pattern_matcher.py::TestPatternMatcher::test_smooth_quant_with_int_mm [GH job link](https://github.com/pytorch/pytorch/actions/runs/11699366379/job/32591132460) [HUD commit link](22e89ea2aa) ([comment](https://github.com/pytorch/pytorch/pull/139132#issuecomment-2459743145))
This commit is contained in:
PyTorch MergeBot
2024-11-06 13:27:41 +00:00
parent 06ad404401
commit 10d7729333
42 changed files with 12 additions and 130 deletions

View File

@ -29,6 +29,7 @@ cppcoreguidelines-*,
-cppcoreguidelines-pro-type-static-cast-downcast, -cppcoreguidelines-pro-type-static-cast-downcast,
-cppcoreguidelines-pro-type-union-access, -cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-non-private-member-variables-in-classes,
-facebook-hte-RelativeInclude, -facebook-hte-RelativeInclude,
hicpp-exception-baseclass, hicpp-exception-baseclass,
@ -63,7 +64,5 @@ readability-string-compare,
HeaderFilterRegex: '^(aten/|c10/|torch/).*$' HeaderFilterRegex: '^(aten/|c10/|torch/).*$'
WarningsAsErrors: '*' WarningsAsErrors: '*'
CheckOptions: CheckOptions:
cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor: true
cppcoreguidelines-special-member-functions.AllowImplicitlyDeletedCopyOrMove: true
misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h;IListRef.h' misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h;IListRef.h'
... ...

View File

@ -604,10 +604,6 @@ inline void manual_seed(uint64_t seed) {
// NoTF32Guard disable_tf32; // NoTF32Guard disable_tf32;
struct TORCH_API NoTF32Guard { struct TORCH_API NoTF32Guard {
NoTF32Guard(); NoTF32Guard();
NoTF32Guard(NoTF32Guard&& other) = delete;
NoTF32Guard(const NoTF32Guard&) = delete;
NoTF32Guard& operator=(const NoTF32Guard&) = delete;
NoTF32Guard& operator=(NoTF32Guard&&) = delete;
~NoTF32Guard(); ~NoTF32Guard();
static bool should_disable_tf32(); static bool should_disable_tf32();
@ -617,10 +613,6 @@ struct TORCH_API NoTF32Guard {
struct TORCH_API ROCmBackwardPassGuard { struct TORCH_API ROCmBackwardPassGuard {
ROCmBackwardPassGuard(); ROCmBackwardPassGuard();
ROCmBackwardPassGuard(ROCmBackwardPassGuard&& other) = delete;
ROCmBackwardPassGuard(const ROCmBackwardPassGuard&) = delete;
ROCmBackwardPassGuard& operator=(const ROCmBackwardPassGuard&) = delete;
ROCmBackwardPassGuard& operator=(ROCmBackwardPassGuard&&) = delete;
~ROCmBackwardPassGuard(); ~ROCmBackwardPassGuard();
static bool is_backward_pass(); static bool is_backward_pass();
}; };

View File

@ -16,8 +16,6 @@ namespace at {
struct DynamicLibrary { struct DynamicLibrary {
AT_DISALLOW_COPY_AND_ASSIGN(DynamicLibrary); AT_DISALLOW_COPY_AND_ASSIGN(DynamicLibrary);
DynamicLibrary(DynamicLibrary&& other) = delete;
DynamicLibrary& operator=(DynamicLibrary&&) = delete;
TORCH_API DynamicLibrary( TORCH_API DynamicLibrary(
const char* name, const char* name,

View File

@ -155,12 +155,6 @@ class CheckSparseTensorInvariants {
: old_state(at::globalContext().checkSparseTensorInvariants()) { : old_state(at::globalContext().checkSparseTensorInvariants()) {
at::globalContext().setCheckSparseTensorInvariants(state); at::globalContext().setCheckSparseTensorInvariants(state);
} }
CheckSparseTensorInvariants(CheckSparseTensorInvariants&& other) = delete;
CheckSparseTensorInvariants(const CheckSparseTensorInvariants&) = delete;
CheckSparseTensorInvariants& operator=(const CheckSparseTensorInvariants&) =
delete;
CheckSparseTensorInvariants& operator=(CheckSparseTensorInvariants&&) =
delete;
~CheckSparseTensorInvariants() { ~CheckSparseTensorInvariants() {
at::globalContext().setCheckSparseTensorInvariants(old_state); at::globalContext().setCheckSparseTensorInvariants(old_state);

View File

@ -995,7 +995,6 @@ class TORCH_API TensorIteratorConfig final {
/// TensorIterator that can use 32-bit indexing. Taken together the splits cover /// TensorIterator that can use 32-bit indexing. Taken together the splits cover
/// the original TensorIterator. /// the original TensorIterator.
struct TORCH_API SplitUntil32Bit { struct TORCH_API SplitUntil32Bit {
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
struct TORCH_API iterator { struct TORCH_API iterator {
iterator() = default; iterator() = default;
iterator(const TensorIteratorBase& iter); iterator(const TensorIteratorBase& iter);

View File

@ -96,10 +96,6 @@ class TORCH_API ThreadLocalStateGuard {
// set the given state across the thread boundary // set the given state across the thread boundary
ThreadLocalState::setThreadLocalState(state); ThreadLocalState::setThreadLocalState(state);
} }
ThreadLocalStateGuard(ThreadLocalStateGuard&& other) = delete;
ThreadLocalStateGuard(const ThreadLocalStateGuard&) = delete;
ThreadLocalStateGuard& operator=(const ThreadLocalStateGuard&) = delete;
ThreadLocalStateGuard& operator=(ThreadLocalStateGuard&&) = delete;
~ThreadLocalStateGuard() { ~ThreadLocalStateGuard() {
// restore previously set variables // restore previously set variables

View File

@ -206,7 +206,6 @@ template<class Key, class Value> Dict<IValue, IValue> toGenericDict(Dict<Key, Va
* for the kernel API. * for the kernel API.
*/ */
template<class Key, class Value> template<class Key, class Value>
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class Dict final { class Dict final {
private: private:
static_assert((std::is_same_v<IValue, Key> && std::is_same_v<IValue, Value>) || guts::typelist::contains<impl::valid_dict_key_types, Key>::value, "Invalid Key type for Dict. We only support int64_t, double, bool, and string."); static_assert((std::is_same_v<IValue, Key> && std::is_same_v<IValue, Value>) || guts::typelist::contains<impl::valid_dict_key_types, Key>::value, "Invalid Key type for Dict. We only support int64_t, double, bool, and string.");

View File

@ -6,10 +6,6 @@ namespace at::impl {
struct TORCH_API RestorePythonTLSSnapshot { struct TORCH_API RestorePythonTLSSnapshot {
RestorePythonTLSSnapshot(); RestorePythonTLSSnapshot();
RestorePythonTLSSnapshot(RestorePythonTLSSnapshot&& other) = delete;
RestorePythonTLSSnapshot(const RestorePythonTLSSnapshot&) = delete;
RestorePythonTLSSnapshot& operator=(const RestorePythonTLSSnapshot&) = delete;
RestorePythonTLSSnapshot& operator=(RestorePythonTLSSnapshot&&) = delete;
~RestorePythonTLSSnapshot(); ~RestorePythonTLSSnapshot();
private: private:
@ -22,10 +18,6 @@ private:
struct TORCH_API MaybeSetTLSOnEntryGuard { struct TORCH_API MaybeSetTLSOnEntryGuard {
public: public:
MaybeSetTLSOnEntryGuard(); MaybeSetTLSOnEntryGuard();
MaybeSetTLSOnEntryGuard(MaybeSetTLSOnEntryGuard&& other) = delete;
MaybeSetTLSOnEntryGuard(const MaybeSetTLSOnEntryGuard&) = delete;
MaybeSetTLSOnEntryGuard& operator=(const MaybeSetTLSOnEntryGuard&) = delete;
MaybeSetTLSOnEntryGuard& operator=(MaybeSetTLSOnEntryGuard&&) = delete;
~MaybeSetTLSOnEntryGuard(); ~MaybeSetTLSOnEntryGuard();
private: private:

View File

@ -40,7 +40,7 @@ struct TORCH_API Quantizer : public c10::intrusive_ptr_target {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members) // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const ScalarType scalar_type_; const ScalarType scalar_type_;
explicit Quantizer(ScalarType scalar_type) : scalar_type_(scalar_type) {} explicit Quantizer(ScalarType scalar_type) : scalar_type_(scalar_type) {}
~Quantizer() override = default; ~Quantizer() override;
// Copied from torch/csrc/jit/ir/scope.h // Copied from torch/csrc/jit/ir/scope.h
QuantizerPtr intrusive_from_this() { QuantizerPtr intrusive_from_this() {

View File

@ -4,7 +4,6 @@
#include <c10/util/Exception.h> #include <c10/util/Exception.h>
namespace at { namespace at {
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class TORCH_API OptionalTensorRef { class TORCH_API OptionalTensorRef {
public: public:
OptionalTensorRef() = default; OptionalTensorRef() = default;
@ -21,7 +20,6 @@ class TORCH_API OptionalTensorRef {
OptionalTensorRef(const OptionalTensorRef& rhs) OptionalTensorRef(const OptionalTensorRef& rhs)
: ref_(Tensor::unsafe_borrow_t{}, rhs.ref_) {} : ref_(Tensor::unsafe_borrow_t{}, rhs.ref_) {}
OptionalTensorRef(OptionalTensorRef&& rhs) = default;
OptionalTensorRef& operator=(OptionalTensorRef rhs) { OptionalTensorRef& operator=(OptionalTensorRef rhs) {
std::swap(ref_, rhs.ref_); std::swap(ref_, rhs.ref_);
return *this; return *this;
@ -61,10 +59,6 @@ class TORCH_API TensorRef {
TensorRef(const TensorBase& src) TensorRef(const TensorBase& src)
: ref_(Tensor::unsafe_borrow_t{}, src) {} : ref_(Tensor::unsafe_borrow_t{}, src) {}
TensorRef(TensorRef&& other) = default;
TensorRef(const TensorRef&) = default;
TensorRef& operator=(const TensorRef&) = default;
TensorRef& operator=(TensorRef&&) = default;
const Tensor& operator*() const & { const Tensor& operator*() const & {
return ref_; return ref_;

View File

@ -39,8 +39,6 @@ struct TORCH_API TorchVital {
explicit TorchVital(std::string n) : name(std::move(n)) {} explicit TorchVital(std::string n) : name(std::move(n)) {}
TorchVital(const TorchVital&) = default; TorchVital(const TorchVital&) = default;
TorchVital(TorchVital&&) = default; TorchVital(TorchVital&&) = default;
TorchVital& operator=(const TorchVital&) = default;
TorchVital& operator=(TorchVital&&) = default;
TorchVital() = delete; TorchVital() = delete;
TorchVitalAttr& create(const std::string& attr); TorchVitalAttr& create(const std::string& attr);
@ -73,7 +71,6 @@ class TORCH_API APIVitals {
APIVitals(APIVitals&& other) = delete; APIVitals(APIVitals&& other) = delete;
APIVitals& operator=(const APIVitals&) = delete; APIVitals& operator=(const APIVitals&) = delete;
APIVitals& operator=(APIVitals&&) = delete; APIVitals& operator=(APIVitals&&) = delete;
~APIVitals() = default;
private: private:
std::unordered_map<std::string, TorchVital> name_map_; std::unordered_map<std::string, TorchVital> name_map_;

View File

@ -159,11 +159,6 @@ class DynamicType : public SharedType {
explicit DynamicType(Tag, Arguments); explicit DynamicType(Tag, Arguments);
explicit DynamicType(Tag, std::string_view, Arguments); explicit DynamicType(Tag, std::string_view, Arguments);
DynamicType(DynamicType&& other) = delete;
DynamicType(const DynamicType&) = delete;
DynamicType& operator=(const DynamicType&) = delete;
DynamicType& operator=(DynamicType&&) = delete;
TypePtr containedType(size_t) const override; TypePtr containedType(size_t) const override;
size_t containedTypeSize() const override; size_t containedTypeSize() const override;
Tag tag() const { Tag tag() const {

View File

@ -2204,7 +2204,7 @@ struct TORCH_API InterfaceType : public NamedType {
return is_module_; return is_module_;
} }
static const TypeKind Kind = TypeKind::InterfaceType; static const TypeKind Kind = TypeKind::InterfaceType;
~InterfaceType() override = default; ~InterfaceType() override;
private: private:
InterfaceType(QualifiedName name, bool is_module); InterfaceType(QualifiedName name, bool is_module);
static bool isSubTypeImpl( static bool isSubTypeImpl(

View File

@ -227,7 +227,6 @@ struct TORCH_API Type {
SingletonOrSharedTypePtr(SingletonOrSharedTypePtr&&) noexcept = default; SingletonOrSharedTypePtr(SingletonOrSharedTypePtr&&) noexcept = default;
SingletonOrSharedTypePtr& operator=(const SingletonOrSharedTypePtr&) = default; SingletonOrSharedTypePtr& operator=(const SingletonOrSharedTypePtr&) = default;
SingletonOrSharedTypePtr& operator=(SingletonOrSharedTypePtr&&) noexcept = default; SingletonOrSharedTypePtr& operator=(SingletonOrSharedTypePtr&&) noexcept = default;
~SingletonOrSharedTypePtr() = default;
T* get() const { T* get() const {
return repr_.isSharedAndNonNull() ? repr_.shared_.repr_.get() : static_cast<T*>(repr_.rawRepr().first); return repr_.isSharedAndNonNull() ? repr_.shared_.repr_.get() : static_cast<T*>(repr_.rawRepr().first);

View File

@ -17,7 +17,6 @@ class C10_EXPORT RRefInterface : public c10::intrusive_ptr_target {
// counting. // counting.
RRefInterface(const RRefInterface& other) = delete; RRefInterface(const RRefInterface& other) = delete;
RRefInterface(RRefInterface&& other) = delete; RRefInterface(RRefInterface&& other) = delete;
RRefInterface& operator=(const RRefInterface& other) = delete;
RRefInterface& operator=(RRefInterface&& other) = delete; RRefInterface& operator=(RRefInterface&& other) = delete;
~RRefInterface() override = default; ~RRefInterface() override = default;

View File

@ -1037,6 +1037,8 @@ InterfaceType::InterfaceType(QualifiedName name, bool is_module)
methods_(std::make_shared<std::vector<FunctionSchema>>()), methods_(std::make_shared<std::vector<FunctionSchema>>()),
is_module_(is_module) {} is_module_(is_module) {}
InterfaceType::~InterfaceType() = default;
bool containsAnyType(const TypePtr& type) { bool containsAnyType(const TypePtr& type) {
std::vector<TypePtr> to_scan = { type }; std::vector<TypePtr> to_scan = { type };
while (!to_scan.empty()) { while (!to_scan.empty()) {

View File

@ -202,8 +202,6 @@ struct SaveLocalDispatchKeySet {
} }
SaveLocalDispatchKeySet(const SaveLocalDispatchKeySet&) = delete; SaveLocalDispatchKeySet(const SaveLocalDispatchKeySet&) = delete;
SaveLocalDispatchKeySet& operator=(const SaveLocalDispatchKeySet&) = delete; SaveLocalDispatchKeySet& operator=(const SaveLocalDispatchKeySet&) = delete;
SaveLocalDispatchKeySet(SaveLocalDispatchKeySet&&) = delete;
SaveLocalDispatchKeySet& operator=(SaveLocalDispatchKeySet&&) = delete;
}; };
const std::vector<DynamicLayer>& getDynamicLayerStack() { const std::vector<DynamicLayer>& getDynamicLayerStack() {
@ -408,10 +406,6 @@ static void dump_local_tls() {
struct WithoutTop { struct WithoutTop {
WithoutTop(); WithoutTop();
WithoutTop(WithoutTop&& other) = delete;
WithoutTop(const WithoutTop&) = delete;
WithoutTop& operator=(const WithoutTop&) = delete;
WithoutTop& operator=(WithoutTop&&) = delete;
~WithoutTop(); ~WithoutTop();
DynamicLayer layer_; DynamicLayer layer_;
}; };

View File

@ -313,6 +313,8 @@ Tensor& PerChannelAffineFloatQParamsQuantizer::dequantize_out(
return rtensor; return rtensor;
} }
Quantizer::~Quantizer() = default;
C10_EXPORT void set_quantizer_(const Tensor& self, ConstQuantizerPtr quantizer) { C10_EXPORT void set_quantizer_(const Tensor& self, ConstQuantizerPtr quantizer) {
get_qtensorimpl(self)->set_quantizer_(quantizer); get_qtensorimpl(self)->set_quantizer_(quantizer);
} }

View File

@ -353,8 +353,6 @@ struct TORCH_API RecordFunction {
RecordFunction(const RecordFunction&) = delete; RecordFunction(const RecordFunction&) = delete;
RecordFunction& operator=(const RecordFunction&) = delete; RecordFunction& operator=(const RecordFunction&) = delete;
RecordFunction(RecordFunction&&) = delete;
RecordFunction& operator=(RecordFunction&&) = delete;
const char* name() const; const char* name() const;
@ -766,10 +764,6 @@ class TORCH_API RecordFunctionGuard {
enableRecordFunction(is_enabled); enableRecordFunction(is_enabled);
} }
RecordFunctionGuard(RecordFunctionGuard&& other) = delete;
RecordFunctionGuard(const RecordFunctionGuard&) = delete;
RecordFunctionGuard& operator=(const RecordFunctionGuard&) = delete;
RecordFunctionGuard& operator=(RecordFunctionGuard&&) = delete;
virtual ~RecordFunctionGuard() { virtual ~RecordFunctionGuard() {
enableRecordFunction(prev_value_); enableRecordFunction(prev_value_);
} }

View File

@ -16,10 +16,6 @@ struct C10_API DisablePythonDispatcher {
PythonDispatcherTLS::set_state({}); PythonDispatcherTLS::set_state({});
} }
DisablePythonDispatcher(DisablePythonDispatcher&& other) = delete;
DisablePythonDispatcher(const DisablePythonDispatcher&) = delete;
DisablePythonDispatcher& operator=(const DisablePythonDispatcher&) = delete;
DisablePythonDispatcher& operator=(DisablePythonDispatcher&&) = delete;
~DisablePythonDispatcher() { ~DisablePythonDispatcher() {
PythonDispatcherTLS::set_state(old_); PythonDispatcherTLS::set_state(old_);
} }

View File

@ -5,7 +5,7 @@
using namespace c10::guts; using namespace c10::guts;
// NOLINTBEGIN(modernize*, cppcoreguidelines-special-member-functions) // NOLINTBEGIN(modernize*)
namespace { namespace {
namespace test_function_traits { namespace test_function_traits {
@ -302,4 +302,4 @@ TEST(MetaprogrammingTest, TupleMap_canBeUsedWithAutoLambdas) {
} // namespace test_tuple_map } // namespace test_tuple_map
} // namespace } // namespace
// NOLINTEND(modernize*, cppcoreguidelines-special-member-functions) // NOLINTEND(modernize*)

View File

@ -148,7 +148,6 @@ TEST(ThreadLocalTest, TestThreadWithGlobalScopeVar) {
TEST(ThreadLocalTest, TestObjectsAreReleased) { TEST(ThreadLocalTest, TestObjectsAreReleased) {
static std::atomic<int> ctors{0}; static std::atomic<int> ctors{0};
static std::atomic<int> dtors{0}; static std::atomic<int> dtors{0};
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
struct A { struct A {
A() { A() {
++ctors; ++ctors;
@ -184,7 +183,6 @@ TEST(ThreadLocalTest, TestObjectsAreReleased) {
TEST(ThreadLocalTest, TestObjectsAreReleasedByNonstaticThreadLocal) { TEST(ThreadLocalTest, TestObjectsAreReleasedByNonstaticThreadLocal) {
static std::atomic<int> ctors(0); static std::atomic<int> ctors(0);
static std::atomic<int> dtors(0); static std::atomic<int> dtors(0);
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
struct A { struct A {
A() { A() {
++ctors; ++ctors;

View File

@ -45,7 +45,6 @@ struct SomeChildClass : SomeBaseClass {
SomeChildClass(int v) : SomeBaseClass(v) {} SomeChildClass(int v) : SomeBaseClass(v) {}
}; };
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class DestructableMock : public intrusive_ptr_target { class DestructableMock : public intrusive_ptr_target {
public: public:
DestructableMock(bool* resourcesReleased, bool* wasDestructed) DestructableMock(bool* resourcesReleased, bool* wasDestructed)

View File

@ -81,7 +81,6 @@ TEST(
} }
namespace { namespace {
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
struct Noncopyable { struct Noncopyable {
int x; int x;

View File

@ -70,7 +70,6 @@ TEST(TypeMetaTest, TypeMeta) {
EXPECT_NE(bar_meta.name().find("TypeMetaTestBar"), c10::string_view::npos); EXPECT_NE(bar_meta.name().find("TypeMetaTestBar"), c10::string_view::npos);
} }
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class ClassAllowAssignment { class ClassAllowAssignment {
public: public:
ClassAllowAssignment() = default; ClassAllowAssignment() = default;
@ -79,7 +78,6 @@ class ClassAllowAssignment {
int x{42}; int x{42};
}; };
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class ClassNoAssignment { class ClassNoAssignment {
public: public:
ClassNoAssignment() = default; ClassNoAssignment() = default;

View File

@ -52,11 +52,6 @@ struct DynamicCounter::Guard {
} }
} }
Guard(Guard&& other) = delete;
Guard(const Guard&) = delete;
Guard& operator=(const Guard&) = delete;
Guard& operator=(Guard&&) = delete;
~Guard() { ~Guard() {
for (const auto& backend : backends_) { for (const auto& backend : backends_) {
backend->unregisterCounter(key_); backend->unregisterCounter(key_);

View File

@ -205,10 +205,6 @@ class C10_API WarningHandlerGuard {
: prev_handler_(c10::WarningUtils::get_warning_handler()) { : prev_handler_(c10::WarningUtils::get_warning_handler()) {
c10::WarningUtils::set_warning_handler(new_handler); c10::WarningUtils::set_warning_handler(new_handler);
} }
WarningHandlerGuard(WarningHandlerGuard&& other) = delete;
WarningHandlerGuard(const WarningHandlerGuard&) = delete;
WarningHandlerGuard& operator=(const WarningHandlerGuard&) = delete;
WarningHandlerGuard& operator=(WarningHandlerGuard&&) = delete;
~WarningHandlerGuard() { ~WarningHandlerGuard() {
c10::WarningUtils::set_warning_handler(prev_handler_); c10::WarningUtils::set_warning_handler(prev_handler_);
} }

View File

@ -18,8 +18,6 @@ struct IncrementRAII final {
~IncrementRAII() { ~IncrementRAII() {
_counter->fetch_sub(1); _counter->fetch_sub(1);
} }
IncrementRAII(IncrementRAII&&) = delete;
IncrementRAII& operator=(IncrementRAII&&) = delete;
private: private:
std::atomic<int32_t>* _counter; std::atomic<int32_t>* _counter;
@ -203,7 +201,6 @@ class RWSafeLeftRightWrapper final {
RWSafeLeftRightWrapper(RWSafeLeftRightWrapper&&) noexcept = delete; RWSafeLeftRightWrapper(RWSafeLeftRightWrapper&&) noexcept = delete;
RWSafeLeftRightWrapper& operator=(const RWSafeLeftRightWrapper&) = delete; RWSafeLeftRightWrapper& operator=(const RWSafeLeftRightWrapper&) = delete;
RWSafeLeftRightWrapper& operator=(RWSafeLeftRightWrapper&&) noexcept = delete; RWSafeLeftRightWrapper& operator=(RWSafeLeftRightWrapper&&) noexcept = delete;
~RWSafeLeftRightWrapper() = default;
template <typename F> template <typename F>
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward) // NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)

View File

@ -139,7 +139,6 @@ struct KeyOrValueEquality : functor_storage<bool, key_equal> {
}; };
static constexpr int8_t min_lookups = 4; static constexpr int8_t min_lookups = 4;
template <typename T> template <typename T>
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
struct sherwood_v3_entry { struct sherwood_v3_entry {
// NOLINTNEXTLINE(modernize-use-equals-default) // NOLINTNEXTLINE(modernize-use-equals-default)
sherwood_v3_entry() {} sherwood_v3_entry() {}

View File

@ -13,10 +13,6 @@ TORCH_API void disableJitRRefPickle();
struct TORCH_API JitRRefPickleGuard { struct TORCH_API JitRRefPickleGuard {
JitRRefPickleGuard(); JitRRefPickleGuard();
JitRRefPickleGuard(JitRRefPickleGuard&& other) = delete;
JitRRefPickleGuard(const JitRRefPickleGuard&) = delete;
JitRRefPickleGuard& operator=(const JitRRefPickleGuard&) = delete;
JitRRefPickleGuard& operator=(JitRRefPickleGuard&&) = delete;
~JitRRefPickleGuard(); ~JitRRefPickleGuard();
}; };

View File

@ -543,10 +543,6 @@ static PyObject* call_end_capture(PyObject* self, const variable_list& inputs) {
struct ClosingTHPObjectPtr : public THPObjectPtr { struct ClosingTHPObjectPtr : public THPObjectPtr {
ClosingTHPObjectPtr(PyObject* o) : THPObjectPtr(o) {} ClosingTHPObjectPtr(PyObject* o) : THPObjectPtr(o) {}
ClosingTHPObjectPtr(ClosingTHPObjectPtr&& other) = default;
ClosingTHPObjectPtr(const ClosingTHPObjectPtr&) = delete;
ClosingTHPObjectPtr& operator=(const ClosingTHPObjectPtr&) = delete;
ClosingTHPObjectPtr& operator=(ClosingTHPObjectPtr&&) = default;
~ClosingTHPObjectPtr() { ~ClosingTHPObjectPtr() {
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
// do nothing, do not attempt to close // do nothing, do not attempt to close

View File

@ -8,7 +8,6 @@ namespace torch::inductor {
// NOTICE: Following APIs are subject to change due to active development // NOTICE: Following APIs are subject to change due to active development
// We provide NO BC guarantee for these APIs // We provide NO BC guarantee for these APIs
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class TORCH_API AOTIModelContainerRunnerCuda : public AOTIModelContainerRunner { class TORCH_API AOTIModelContainerRunnerCuda : public AOTIModelContainerRunner {
public: public:
// @param device_str: cuda device string, e.g. "cuda", "cuda:0" // @param device_str: cuda device string, e.g. "cuda", "cuda:0"

View File

@ -98,6 +98,8 @@ Node::Node(OpKind op, Shape shape, size_t num_outputs) : Node(op, num_outputs) {
shapes_.push_back(std::move(shape)); shapes_.push_back(std::move(shape));
} }
Node::~Node() = default;
// Retrieves the full shape of the IR Node. // Retrieves the full shape of the IR Node.
c10::ArrayRef<Shape> Node::shapes() const { c10::ArrayRef<Shape> Node::shapes() const {
return shapes_; return shapes_;

View File

@ -101,7 +101,7 @@ class TORCH_API Node {
// Construct node with shape and no operands // Construct node with shape and no operands
Node(OpKind op, Shape shape, size_t num_outputs = 1); Node(OpKind op, Shape shape, size_t num_outputs = 1);
virtual ~Node() = default; virtual ~Node();
const OpKind& op() const { const OpKind& op() const {
return op_; return op_;

View File

@ -38,10 +38,6 @@ struct TORCH_API MetaData {
struct TORCH_API ScopePusher { struct TORCH_API ScopePusher {
explicit ScopePusher(const std::string& name); explicit ScopePusher(const std::string& name);
~ScopePusher(); ~ScopePusher();
ScopePusher(ScopePusher&& other) = delete;
ScopePusher(const ScopePusher&) = delete;
ScopePusher& operator=(const ScopePusher&) = delete;
ScopePusher& operator=(ScopePusher&&) = delete;
static void ResetScopes(); static void ResetScopes();
}; };

View File

@ -258,10 +258,6 @@ class TORCH_API TimedSection {
public: public:
explicit TimedSection(Metric* metric) : metric_(metric), start_(NowNs()) {} explicit TimedSection(Metric* metric) : metric_(metric), start_(NowNs()) {}
TimedSection(TimedSection&& other) = delete;
TimedSection(const TimedSection&) = delete;
TimedSection& operator=(const TimedSection&) = delete;
TimedSection& operator=(TimedSection&&) = delete;
~TimedSection() { ~TimedSection() {
int64_t now = NowNs(); int64_t now = NowNs();
metric_->AddSample(now, static_cast<double>(now - start_)); metric_->AddSample(now, static_cast<double>(now - start_));

View File

@ -42,18 +42,12 @@ class TORCH_API LazyTensor : public c10::intrusive_ptr_target {
Data(BackendDevice device) Data(BackendDevice device)
: device(std::move(device)), unique_id(GetNextTensorId()) {} : device(std::move(device)), unique_id(GetNextTensorId()) {}
Data(Data&& other) = delete;
Data(const Data&) = delete;
Data& operator=(const Data&) = delete;
Data& operator=(Data&&) = delete;
virtual ~Data(); virtual ~Data();
BackendDataPtr handle; BackendDataPtr handle;
Value ir_value; Value ir_value;
std::optional<at::Tensor> tensor_data; std::optional<at::Tensor> tensor_data;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const BackendDevice device; const BackendDevice device;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
const int64_t unique_id = 0; const int64_t unique_id = 0;
size_t generation = 1; size_t generation = 1;
}; };
@ -74,8 +68,6 @@ class TORCH_API LazyTensor : public c10::intrusive_ptr_target {
LazyTensor() = delete; LazyTensor() = delete;
LazyTensor(const LazyTensor&) = default; LazyTensor(const LazyTensor&) = default;
LazyTensor(LazyTensor&&) noexcept = default; LazyTensor(LazyTensor&&) noexcept = default;
LazyTensor& operator=(const LazyTensor&) = default;
LazyTensor& operator=(LazyTensor&&) noexcept = default;
~LazyTensor() override = default; ~LazyTensor() override = default;

View File

@ -26,10 +26,6 @@ class ThreadPool {
}); });
} }
} }
ThreadPool(const ThreadPool&) = delete;
ThreadPool(ThreadPool&&) = delete;
ThreadPool& operator=(const ThreadPool&) = delete;
ThreadPool& operator=(ThreadPool&&) = delete;
~ThreadPool() { ~ThreadPool() {
{ {

View File

@ -13,7 +13,6 @@
namespace torch::lazy { namespace torch::lazy {
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class TORCH_API Completion { class TORCH_API Completion {
public: public:
class Data; class Data;

View File

@ -122,10 +122,6 @@ class Stat {
maxSamples_(maxSamples) { maxSamples_(maxSamples) {
detail::registerStat(this); detail::registerStat(this);
} }
Stat(const Stat&) = delete;
Stat(Stat&&) = delete;
Stat& operator=(const Stat&) = delete;
Stat& operator=(Stat&&) = delete;
virtual ~Stat() { virtual ~Stat() {
{ {

View File

@ -402,10 +402,6 @@ struct StealOrDefault {
explicit StealOrDefault(T& container) explicit StealOrDefault(T& container)
: container_{container}, it_{container.begin()} {} : container_{container}, it_{container.begin()} {}
StealOrDefault(const StealOrDefault&) = delete;
StealOrDefault(StealOrDefault&&) = delete;
StealOrDefault& operator=(const StealOrDefault&) = delete;
StealOrDefault& operator=(StealOrDefault&&) = delete;
~StealOrDefault() { ~StealOrDefault() {
container_.get().clear(); container_.get().clear();
} }

View File

@ -128,10 +128,6 @@ struct TORCH_API ProfilerConfig {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
struct TORCH_API ProfilerStateBase : public c10::MemoryReportingInfoBase { struct TORCH_API ProfilerStateBase : public c10::MemoryReportingInfoBase {
explicit ProfilerStateBase(ProfilerConfig config); explicit ProfilerStateBase(ProfilerConfig config);
ProfilerStateBase(const ProfilerStateBase&) = delete;
ProfilerStateBase(ProfilerStateBase&&) = delete;
ProfilerStateBase& operator=(const ProfilerStateBase&) = delete;
ProfilerStateBase& operator=(ProfilerStateBase&&) = delete;
~ProfilerStateBase() override; ~ProfilerStateBase() override;
static ProfilerStateBase* get(bool global); static ProfilerStateBase* get(bool global);