Skip to content

Add cppcoreguidelines-special-member-functions check #4531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Checks: '
clang-analyzer*,
clang-diagnostic-missing-prototypes,
cppcoreguidelines-init-variables,
cppcoreguidelines-special-member-functions,
bugprone*,
-bugprone-crtp-constructor-accessibility,
-bugprone-easily-swappable-parameters,
Expand Down Expand Up @@ -72,4 +73,8 @@ CheckOptions:
- key: facebook-cuda-safe-kernel-call-check.HandlerName
# This is PyTorch's handler; you may need to define your own
value: C10_CUDA_KERNEL_LAUNCH_CHECK
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
value: true
- key: cppcoreguidelines-special-member-functions.AllowImplicitlyDeletedCopyOrMove
value: true
...
22 changes: 18 additions & 4 deletions include/fbgemm/Fbgemm.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class PackMatrix {
public:
PackMatrix() = delete; // no default constructor
PackMatrix(const PackMatrix&) = delete; // no copy
PackMatrix& operator==(const PackMatrix&) = delete; // no copy
PackMatrix& operator=(const PackMatrix&) = delete; // no copy
PackMatrix(PackMatrix&&) = delete; // no move
PackMatrix& operator==(PackMatrix&& rhs) noexcept = delete; // no move
PackMatrix& operator=(PackMatrix&& rhs) noexcept = delete; // no move

/**
* @param rows total number of rows in the matrix
Expand Down Expand Up @@ -515,11 +515,11 @@ class FBGEMM_API PackWeightMatrixForGConv {

PackWeightMatrixForGConv() = delete; // no default constructor
PackWeightMatrixForGConv(const PackWeightMatrixForGConv&) = delete; // no copy
PackWeightMatrixForGConv& operator==(const PackWeightMatrixForGConv&) =
PackWeightMatrixForGConv& operator=(const PackWeightMatrixForGConv&) =
delete; // no copy

PackWeightMatrixForGConv(PackWeightMatrixForGConv&&) = delete; // no move
PackWeightMatrixForGConv& operator==(PackWeightMatrixForGConv&&) =
PackWeightMatrixForGConv& operator=(PackWeightMatrixForGConv&&) =
delete; // no move

/**
Expand Down Expand Up @@ -715,6 +715,11 @@ class FBGEMM_API PackAWithIm2Col
bool b_symmetric = false,
const BlockingFactors* params = nullptr);

PackAWithIm2Col(const PackAWithIm2Col&) = delete;
PackAWithIm2Col(PackAWithIm2Col&&) = delete;
PackAWithIm2Col& operator=(const PackAWithIm2Col&) = delete;
PackAWithIm2Col& operator=(PackAWithIm2Col&&) = delete;

/**
* Activation matrices are not constant so cannot amortize the cost of
* pre-packing.
Expand Down Expand Up @@ -799,6 +804,11 @@ class FBGEMM_API PackAWithRowOffset final
std::int32_t* row_offset = nullptr,
const BlockingFactors* params = nullptr);

PackAWithRowOffset(const PackAWithRowOffset&) = delete;
PackAWithRowOffset(PackAWithRowOffset&&) = delete;
PackAWithRowOffset& operator=(const PackAWithRowOffset&) = delete;
PackAWithRowOffset& operator=(PackAWithRowOffset&&) = delete;

/**
* Activation matrices are not constant so cannot amortize the cost of
* pre-packing.
Expand Down Expand Up @@ -890,6 +900,10 @@ class FBGEMM_API PackAWithQuantRowOffset final
int groups = 1,
std::int32_t* row_offset = nullptr,
const BlockingFactors* params = nullptr);
PackAWithQuantRowOffset(const PackAWithQuantRowOffset&) = delete;
PackAWithQuantRowOffset(PackAWithQuantRowOffset&&) = delete;
PackAWithQuantRowOffset& operator=(const PackAWithQuantRowOffset&) = delete;
PackAWithQuantRowOffset& operator=(PackAWithQuantRowOffset&&) = delete;

/**
* Activation matrices are not constant so cannot amortize the cost of
Expand Down
5 changes: 4 additions & 1 deletion include/fbgemm/FbgemmI8DepthwiseAvx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once

#include <array>
#include <cstdint>
#include "fbgemm/ConvUtils.h"
#include "fbgemm/FbgemmBuild.h"
Expand All @@ -27,6 +26,10 @@ class FBGEMM_API PackedDepthWiseConvMatrix {
* @param smat the source unpacked weight in GRS layout
*/
PackedDepthWiseConvMatrix(int OC, int kernel_prod, const std::int8_t* smat);
PackedDepthWiseConvMatrix(const PackedDepthWiseConvMatrix&) = delete;
PackedDepthWiseConvMatrix(PackedDepthWiseConvMatrix&&) = delete;
PackedDepthWiseConvMatrix& operator=(const PackedDepthWiseConvMatrix&) = delete;
PackedDepthWiseConvMatrix& operator=(PackedDepthWiseConvMatrix&&) = delete;
virtual ~PackedDepthWiseConvMatrix();

const std::int8_t* PackedMat() const {
Expand Down
5 changes: 5 additions & 0 deletions include/fbgemm/FbgemmI8DirectconvAvx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ class FBGEMM_API PackedDirectConvMatrix {
int OC_per_G,
int filter_prod,
const std::int8_t* smat);
PackedDirectConvMatrix(const PackedDirectConvMatrix&) = delete;
PackedDirectConvMatrix(PackedDirectConvMatrix&&) = delete;
PackedDirectConvMatrix& operator=(const PackedDirectConvMatrix&) = delete;
PackedDirectConvMatrix& operator=(PackedDirectConvMatrix&&) = delete;

virtual ~PackedDirectConvMatrix();

const std::int8_t* PackedMat() const {
Expand Down
4 changes: 4 additions & 0 deletions include/fbgemm/FbgemmPackMatrixB.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ class PackedGemmMatrixB {
packed_ = true;
pmat_passed_in = true;
}
PackedGemmMatrixB(const PackedGemmMatrixB&) = delete;
PackedGemmMatrixB(PackedGemmMatrixB&&) = delete;
PackedGemmMatrixB& operator=(const PackedGemmMatrixB&) = delete;
PackedGemmMatrixB& operator=(PackedGemmMatrixB&&) = delete;

void initializeParam() {
if (!cpuinfo_initialize()) {
Expand Down
Loading