diff --git a/.clang-tidy b/.clang-tidy index e073b75ae07002bff7e2867f8ada50f2ae376aea..38957a23d1d3c02e4d5dcf87c733235d7ee41293 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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, diff --git a/paddle/phi/core/dense_tensor.cc b/paddle/phi/core/dense_tensor.cc index 598875a15fa15e06e246db174a8cb1df2320b760..afb2f58571640e60575cf28ef308de86bda8d815 100644 --- a/paddle/phi/core/dense_tensor.cc +++ b/paddle/phi/core/dense_tensor.cc @@ -52,7 +52,8 @@ DenseTensor::DenseTensor(const std::shared_ptr& 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_)); diff --git a/paddle/phi/core/sparse_coo_tensor.cc b/paddle/phi/core/sparse_coo_tensor.cc index 6e7543016f0a08415d38653653f7a41262cbeada..f1568eacc0849743368c6b5b20767a3b2d0a3a47 100644 --- a/paddle/phi/core/sparse_coo_tensor.cc +++ b/paddle/phi/core/sparse_coo_tensor.cc @@ -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()); } diff --git a/paddle/phi/core/sparse_csr_tensor.cc b/paddle/phi/core/sparse_csr_tensor.cc index ab31a63f4a0f8fb1ec16532b651d5fddd8f9a917..0dc0807a36baf148d026240d06b1b86949cea152 100644 --- a/paddle/phi/core/sparse_csr_tensor.cc +++ b/paddle/phi/core/sparse_csr_tensor.cc @@ -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()); } diff --git a/paddle/phi/core/string_tensor.cc b/paddle/phi/core/string_tensor.cc index 0e465982ba429a4ffdf0c861f1d1ca8388a64573..e30754ad7fd935f1d92749e1fea3b5a61ccce60d 100644 --- a/paddle/phi/core/string_tensor.cc +++ b/paddle/phi/core/string_tensor.cc @@ -37,7 +37,8 @@ StringTensor::StringTensor(const std::shared_ptr& 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_; }