未验证 提交 c0f5dac6 编写于 作者: Z Zhenghai Zhang 提交者: GitHub

[clang-tidy] NO.65 enable `clang-analyzer-cplusplus.InnerPointer` check (#56693)

* enable clang-analyzer-cplusplus.InnerPointer check

* fix bug
上级 d7e0f875
...@@ -67,7 +67,7 @@ bugprone-unused-raii, ...@@ -67,7 +67,7 @@ bugprone-unused-raii,
-clang-analyzer-core.uninitialized.Branch, -clang-analyzer-core.uninitialized.Branch,
-clang-analyzer-core.uninitialized.CapturedBlockVariable, -clang-analyzer-core.uninitialized.CapturedBlockVariable,
-clang-analyzer-core.uninitialized.UndefReturn, -clang-analyzer-core.uninitialized.UndefReturn,
-clang-analyzer-cplusplus.InnerPointer, clang-analyzer-cplusplus.InnerPointer,
-clang-analyzer-cplusplus.Move, -clang-analyzer-cplusplus.Move,
-clang-analyzer-cplusplus.NewDelete, -clang-analyzer-cplusplus.NewDelete,
-clang-analyzer-cplusplus.NewDeleteLeaks, -clang-analyzer-cplusplus.NewDeleteLeaks,
......
...@@ -277,16 +277,14 @@ struct RowwiseAdd<phi::CPUContext, T> { ...@@ -277,16 +277,14 @@ struct RowwiseAdd<phi::CPUContext, T> {
" Expected vector size=%d, but received %d", " Expected vector size=%d, but received %d",
size, size,
vector.numel())); vector.numel()));
const char* in_dims_cstr = in_dims.to_str().c_str();
const char* out_dims_cstr = out_dims.to_str().c_str();
PADDLE_ENFORCE_EQ(out_dims, PADDLE_ENFORCE_EQ(out_dims,
in_dims, in_dims,
phi::errors::InvalidArgument( phi::errors::InvalidArgument(
"The output tensor shape should be same as the input" "The output tensor shape should be same as the input"
" tensor shape. Expected output tensor shape: %s," " tensor shape. Expected output tensor shape: %s,"
" but received %s", " but received %s",
in_dims_cstr, in_dims.to_str().c_str(),
out_dims_cstr)); out_dims.to_str().c_str()));
auto in = phi::EigenMatrix<T>::From(input); auto in = phi::EigenMatrix<T>::From(input);
auto vec = phi::EigenVector<T>::Flatten(vector); auto vec = phi::EigenVector<T>::Flatten(vector);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册