Skip to content

Commit

Permalink
[clang-tidy] No.51 enable bugprone-copy-constructor-init (#56219)
Browse files Browse the repository at this point in the history
  • Loading branch information
enkilee authored Aug 14, 2023
1 parent 465b43e commit ba9bb6b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Checks: '
-bugprone-bad-signal-to-kill-thread,
-bugprone-bool-pointer-implicit-conversion,
-bugprone-branch-clone,
-bugprone-copy-constructor-init,
bugprone-copy-constructor-init,
-bugprone-dangling-handle,
-bugprone-dynamic-static-initializers,
-bugprone-exception-escape,
Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/core/dense_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ DenseTensor::DenseTensor(const std::shared_ptr<phi::Allocation>& holder,
const DenseTensorMeta& meta)
: meta_(meta), holder_(holder) {}

DenseTensor::DenseTensor(const DenseTensor& other) : meta_(other.meta()) {
DenseTensor::DenseTensor(const DenseTensor& other) {
this->meta_ = other.meta();
holder_ = other.holder_;
storage_properties_ =
std::move(CopyStorageProperties(other.storage_properties_));
Expand Down
6 changes: 3 additions & 3 deletions paddle/phi/core/sparse_coo_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ SparseCooTensor::SparseCooTensor(DenseTensor&& non_zero_indices,
meta_.dtype = non_zero_elements.dtype();
}

SparseCooTensor::SparseCooTensor(const SparseCooTensor& other)
: non_zero_indices_(other.non_zero_indices_),
non_zero_elements_(other.non_zero_elements_) {
SparseCooTensor::SparseCooTensor(const SparseCooTensor& other) {
this->non_zero_indices_ = other.non_zero_indices_;
this->non_zero_elements_ = other.non_zero_elements_;
this->coalesced_ = other.coalesced_;
set_meta(other.meta());
}
Expand Down
8 changes: 4 additions & 4 deletions paddle/phi/core/sparse_csr_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ SparseCsrTensor::SparseCsrTensor(const DenseTensor& non_zero_crows,
meta_.dtype = non_zero_elements.dtype();
}

SparseCsrTensor::SparseCsrTensor(const SparseCsrTensor& other)
: non_zero_crows_(other.non_zero_crows_),
non_zero_cols_(other.non_zero_cols_),
non_zero_elements_(other.non_zero_elements_) {
SparseCsrTensor::SparseCsrTensor(const SparseCsrTensor& other) {
this->non_zero_crows_ = other.non_zero_crows_;
this->non_zero_cols_ = other.non_zero_cols_;
this->non_zero_elements_ = other.non_zero_elements_;
set_meta(other.meta());
}

Expand Down
3 changes: 2 additions & 1 deletion paddle/phi/core/string_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ StringTensor::StringTensor(const std::shared_ptr<phi::Allocation>& holder,
const StringTensorMeta& meta)
: meta_(meta), holder_(holder) {}

StringTensor::StringTensor(const StringTensor& other) : meta_(other.meta()) {
StringTensor::StringTensor(const StringTensor& other) {
this->meta_ = other.meta();
holder_ = other.holder_;
}

Expand Down

0 comments on commit ba9bb6b

Please sign in to comment.