未验证 提交 ba9bb6bc 编写于 作者: C cyberslack_lee 提交者: GitHub

[clang-tidy] No.51 enable bugprone-copy-constructor-init (#56219)

上级 465b43e9
...@@ -5,7 +5,7 @@ Checks: ' ...@@ -5,7 +5,7 @@ Checks: '
-bugprone-bad-signal-to-kill-thread, -bugprone-bad-signal-to-kill-thread,
-bugprone-bool-pointer-implicit-conversion, -bugprone-bool-pointer-implicit-conversion,
-bugprone-branch-clone, -bugprone-branch-clone,
-bugprone-copy-constructor-init, bugprone-copy-constructor-init,
-bugprone-dangling-handle, -bugprone-dangling-handle,
-bugprone-dynamic-static-initializers, -bugprone-dynamic-static-initializers,
-bugprone-exception-escape, -bugprone-exception-escape,
......
...@@ -52,7 +52,8 @@ DenseTensor::DenseTensor(const std::shared_ptr<phi::Allocation>& holder, ...@@ -52,7 +52,8 @@ DenseTensor::DenseTensor(const std::shared_ptr<phi::Allocation>& holder,
const DenseTensorMeta& meta) const DenseTensorMeta& meta)
: meta_(meta), holder_(holder) {} : meta_(meta), holder_(holder) {}
DenseTensor::DenseTensor(const DenseTensor& other) : meta_(other.meta()) { DenseTensor::DenseTensor(const DenseTensor& other) {
this->meta_ = other.meta();
holder_ = other.holder_; holder_ = other.holder_;
storage_properties_ = storage_properties_ =
std::move(CopyStorageProperties(other.storage_properties_)); std::move(CopyStorageProperties(other.storage_properties_));
......
...@@ -50,9 +50,9 @@ SparseCooTensor::SparseCooTensor(DenseTensor&& non_zero_indices, ...@@ -50,9 +50,9 @@ SparseCooTensor::SparseCooTensor(DenseTensor&& non_zero_indices,
meta_.dtype = non_zero_elements.dtype(); meta_.dtype = non_zero_elements.dtype();
} }
SparseCooTensor::SparseCooTensor(const SparseCooTensor& other) SparseCooTensor::SparseCooTensor(const SparseCooTensor& other) {
: non_zero_indices_(other.non_zero_indices_), this->non_zero_indices_ = other.non_zero_indices_;
non_zero_elements_(other.non_zero_elements_) { this->non_zero_elements_ = other.non_zero_elements_;
this->coalesced_ = other.coalesced_; this->coalesced_ = other.coalesced_;
set_meta(other.meta()); set_meta(other.meta());
} }
......
...@@ -66,10 +66,10 @@ SparseCsrTensor::SparseCsrTensor(const DenseTensor& non_zero_crows, ...@@ -66,10 +66,10 @@ SparseCsrTensor::SparseCsrTensor(const DenseTensor& non_zero_crows,
meta_.dtype = non_zero_elements.dtype(); meta_.dtype = non_zero_elements.dtype();
} }
SparseCsrTensor::SparseCsrTensor(const SparseCsrTensor& other) SparseCsrTensor::SparseCsrTensor(const SparseCsrTensor& other) {
: non_zero_crows_(other.non_zero_crows_), this->non_zero_crows_ = other.non_zero_crows_;
non_zero_cols_(other.non_zero_cols_), this->non_zero_cols_ = other.non_zero_cols_;
non_zero_elements_(other.non_zero_elements_) { this->non_zero_elements_ = other.non_zero_elements_;
set_meta(other.meta()); set_meta(other.meta());
} }
......
...@@ -37,7 +37,8 @@ StringTensor::StringTensor(const std::shared_ptr<phi::Allocation>& holder, ...@@ -37,7 +37,8 @@ StringTensor::StringTensor(const std::shared_ptr<phi::Allocation>& holder,
const StringTensorMeta& meta) const StringTensorMeta& meta)
: meta_(meta), holder_(holder) {} : meta_(meta), holder_(holder) {}
StringTensor::StringTensor(const StringTensor& other) : meta_(other.meta()) { StringTensor::StringTensor(const StringTensor& other) {
this->meta_ = other.meta();
holder_ = other.holder_; holder_ = other.holder_;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册