未验证 提交 f2c7d162 编写于 作者: G gouzil 提交者: GitHub

[clang-tidy] enable clang-analyzer-core.uninitialized.Assign check (#56637)

上级 1409e4ec
...@@ -63,7 +63,7 @@ bugprone-unused-raii, ...@@ -63,7 +63,7 @@ bugprone-unused-raii,
-clang-analyzer-core.builtin.BuiltinFunctions, -clang-analyzer-core.builtin.BuiltinFunctions,
-clang-analyzer-core.builtin.NoReturnFunctions, -clang-analyzer-core.builtin.NoReturnFunctions,
-clang-analyzer-core.uninitialized.ArraySubscript, -clang-analyzer-core.uninitialized.ArraySubscript,
-clang-analyzer-core.uninitialized.Assign, clang-analyzer-core.uninitialized.Assign,
-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,
......
...@@ -590,7 +590,7 @@ struct STanhGradFunctor : public BaseActivationFunctor<T> { ...@@ -590,7 +590,7 @@ struct STanhGradFunctor : public BaseActivationFunctor<T> {
typename dOut, typename dOut,
typename dX> typename dX>
void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const { 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 b = static_cast<T>(scale_b);
auto temp = (a * x).tanh() * (a * x).tanh(); auto temp = (a * x).tanh() * (a * x).tanh();
dx.device(d) = dout * a * b * (static_cast<T>(1) - temp); dx.device(d) = dout * a * b * (static_cast<T>(1) - temp);
...@@ -1557,7 +1557,7 @@ struct ThresholdedReluFunctor : public BaseActivationFunctor<T> { ...@@ -1557,7 +1557,7 @@ struct ThresholdedReluFunctor : public BaseActivationFunctor<T> {
template <typename Device, typename X, typename Out> template <typename Device, typename X, typename Out>
void operator()(Device d, X x, Out out) const { 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; out.device(d) = (x > th).template cast<T>() * x;
} }
}; };
...@@ -1575,7 +1575,7 @@ struct ThresholdedReluGradFunctor : public BaseActivationFunctor<T> { ...@@ -1575,7 +1575,7 @@ struct ThresholdedReluGradFunctor : public BaseActivationFunctor<T> {
typename dOut, typename dOut,
typename dX> typename dX>
void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const { 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>(); dx.device(d) = dout * (x > th).template cast<T>();
} }
...@@ -1692,7 +1692,7 @@ struct SoftShrinkFunctor : public BaseActivationFunctor<T> { ...@@ -1692,7 +1692,7 @@ struct SoftShrinkFunctor : public BaseActivationFunctor<T> {
template <typename Device, typename X, typename Out> template <typename Device, typename X, typename Out>
void operator()(Device d, X x, Out out) const { 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 temp1 = (x > lambdaT).template cast<T>();
auto temp2 = (x < -lambdaT).template cast<T>(); auto temp2 = (x < -lambdaT).template cast<T>();
out.device(d) = temp1 * (x - lambdaT) + temp2 * (x + lambdaT); out.device(d) = temp1 * (x - lambdaT) + temp2 * (x + lambdaT);
...@@ -1711,7 +1711,7 @@ struct SoftShrinkGradFunctor : public BaseActivationFunctor<T> { ...@@ -1711,7 +1711,7 @@ struct SoftShrinkGradFunctor : public BaseActivationFunctor<T> {
typename dOut, typename dOut,
typename dX> typename dX>
void operator()(Device d, X x, Out out UNUSED, dOut dout, dX dx) const { 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 temp1 = (x > lambdaT).template cast<T>();
auto temp2 = (x < -lambdaT).template cast<T>(); auto temp2 = (x < -lambdaT).template cast<T>();
dx.device(d) = dout * (temp1 + temp2).template cast<T>(); dx.device(d) = dout * (temp1 + temp2).template cast<T>();
......
...@@ -1026,7 +1026,7 @@ void gpc_polygon_clip(gpc_op op, ...@@ -1026,7 +1026,7 @@ void gpc_polygon_clip(gpc_op op,
/* Set yb and yt to the bottom and top of the scanbeam */ /* Set yb and yt to the bottom and top of the scanbeam */
yb = sbt[scanbeam++]; yb = sbt[scanbeam++];
if (scanbeam < sbt_entries) { if (scanbeam < sbt_entries) {
yt = sbt[scanbeam]; yt = sbt[scanbeam]; // NOLINT
dy = yt - yb; dy = yt - yb;
} }
/* === SCANBEAM BOUNDARY PROCESSING ================================ */ /* === SCANBEAM BOUNDARY PROCESSING ================================ */
...@@ -1664,7 +1664,7 @@ void gpc_tristrip_clip(gpc_op op, ...@@ -1664,7 +1664,7 @@ void gpc_tristrip_clip(gpc_op op,
/* Set yb and yt to the bottom and top of the scanbeam */ /* Set yb and yt to the bottom and top of the scanbeam */
yb = sbt[scanbeam++]; yb = sbt[scanbeam++];
if (scanbeam < sbt_entries) { if (scanbeam < sbt_entries) {
yt = sbt[scanbeam]; yt = sbt[scanbeam]; // NOLINT
dy = yt - yb; dy = yt - yb;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册