Skip to content

Commit

Permalink
[clang-tidy] enable clang-analyzer-core.uninitialized.Assign check (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gouzil authored Aug 29, 2023
1 parent 1409e4e commit f2c7d16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bugprone-unused-raii,
-clang-analyzer-core.builtin.BuiltinFunctions,
-clang-analyzer-core.builtin.NoReturnFunctions,
-clang-analyzer-core.uninitialized.ArraySubscript,
-clang-analyzer-core.uninitialized.Assign,
clang-analyzer-core.uninitialized.Assign,
-clang-analyzer-core.uninitialized.Branch,
-clang-analyzer-core.uninitialized.CapturedBlockVariable,
-clang-analyzer-core.uninitialized.UndefReturn,
Expand Down
10 changes: 5 additions & 5 deletions paddle/phi/kernels/funcs/activation_functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ struct STanhGradFunctor : public BaseActivationFunctor<T> {
typename dOut,
typename dX>
void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const {
auto a = static_cast<T>(scale_a);
auto a = static_cast<T>(scale_a); // NOLINT
auto b = static_cast<T>(scale_b);
auto temp = (a * x).tanh() * (a * x).tanh();
dx.device(d) = dout * a * b * (static_cast<T>(1) - temp);
Expand Down Expand Up @@ -1557,7 +1557,7 @@ struct ThresholdedReluFunctor : public BaseActivationFunctor<T> {

template <typename Device, typename X, typename Out>
void operator()(Device d, X x, Out out) const {
auto th = static_cast<T>(threshold);
auto th = static_cast<T>(threshold); // NOLINT
out.device(d) = (x > th).template cast<T>() * x;
}
};
Expand All @@ -1575,7 +1575,7 @@ struct ThresholdedReluGradFunctor : public BaseActivationFunctor<T> {
typename dOut,
typename dX>
void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const {
auto th = static_cast<T>(threshold);
auto th = static_cast<T>(threshold); // NOLINT
dx.device(d) = dout * (x > th).template cast<T>();
}

Expand Down Expand Up @@ -1692,7 +1692,7 @@ struct SoftShrinkFunctor : public BaseActivationFunctor<T> {

template <typename Device, typename X, typename Out>
void operator()(Device d, X x, Out out) const {
auto lambdaT = static_cast<T>(lambda);
auto lambdaT = static_cast<T>(lambda); // NOLINT
auto temp1 = (x > lambdaT).template cast<T>();
auto temp2 = (x < -lambdaT).template cast<T>();
out.device(d) = temp1 * (x - lambdaT) + temp2 * (x + lambdaT);
Expand All @@ -1711,7 +1711,7 @@ struct SoftShrinkGradFunctor : public BaseActivationFunctor<T> {
typename dOut,
typename dX>
void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const {
auto lambdaT = static_cast<T>(lambda);
auto lambdaT = static_cast<T>(lambda); // NOLINT
auto temp1 = (x > lambdaT).template cast<T>();
auto temp2 = (x < -lambdaT).template cast<T>();
dx.device(d) = dout * (temp1 + temp2).template cast<T>();
Expand Down
4 changes: 2 additions & 2 deletions paddle/phi/kernels/funcs/gpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ void gpc_polygon_clip(gpc_op op,
/* Set yb and yt to the bottom and top of the scanbeam */
yb = sbt[scanbeam++];
if (scanbeam < sbt_entries) {
yt = sbt[scanbeam];
yt = sbt[scanbeam]; // NOLINT
dy = yt - yb;
}
/* === SCANBEAM BOUNDARY PROCESSING ================================ */
Expand Down Expand Up @@ -1664,7 +1664,7 @@ void gpc_tristrip_clip(gpc_op op,
/* Set yb and yt to the bottom and top of the scanbeam */
yb = sbt[scanbeam++];
if (scanbeam < sbt_entries) {
yt = sbt[scanbeam];
yt = sbt[scanbeam]; // NOLINT
dy = yt - yb;
}

Expand Down

0 comments on commit f2c7d16

Please sign in to comment.