-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[CPU] Apply 'readability-avoid-nested-conditional-operator' clang-tidy remarks #30806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CPU] Apply 'readability-avoid-nested-conditional-operator' clang-tidy remarks #30806
Conversation
7b0b152
to
d457eac
Compare
357d5dd
to
47778be
Compare
26ead9e
to
d271499
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes readability-avoid-nested-conditional-operator clang-tidy remarks by replacing nested ternary expressions with equivalent if
/else
structures (often wrapped in immediately-invoked lambdas) across the Intel CPU plugin code and re-enables the check in CI.
- Converted deeply nested
?:
chains to clearif
/else
logic or lambdas in various nodes and kernels - Added
<utility>
include to support structured bindings - Re-enabled the
readability-avoid-nested-conditional-operator
check in.clang-tidy
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp | Replaced nested ternary for real_num_classes |
src/plugins/intel_cpu/src/nodes/matrix_nms.cpp | Replaced nested ternary for real_num_classes |
src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp | Broke ternaries into if /else for several fields |
src/plugins/intel_cpu/src/nodes/istft.cpp | Expanded ternary to if /else for final length |
src/plugins/intel_cpu/src/nodes/interpolate.cpp | Replaced ternary for eltInGrid with if /else |
src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp | Replaced ternary for eltInGrid with lambda |
src/plugins/intel_cpu/src/nodes/input.cpp | Normalized auto const* to const auto* |
src/plugins/intel_cpu/src/nodes/gather.cpp | Expanded ISA detection ternary to if /else |
src/plugins/intel_cpu/src/nodes/fake_quantize.cpp | Multiple nested ternaries refactored |
src/plugins/intel_cpu/src/nodes/eltwise.cpp | Converted nested conditional for implType |
src/plugins/intel_cpu/src/nodes/depth_to_space.cpp | Replaced ternary for layoutType |
src/plugins/intel_cpu/src/nodes/deconv.cpp | Expanded channel block and format tag ternaries |
src/plugins/intel_cpu/src/nodes/conv.cpp | Expanded ternaries for autoPadding |
src/plugins/intel_cpu/src/nodes/bin_conv.cpp | Replaced multiple nested ternaries |
src/plugins/intel_cpu/src/infer_request.cpp | Replaced nested conditional for shape |
src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.cpp | Expanded vector length ternary |
src/plugins/intel_cpu/src/emitters/plugin/x64/debug_capabilities.cpp | Broke VMM save/restore ternaries into if /else |
src/plugins/intel_cpu/src/cpu_streams_calculation.cpp | Expanded thread/stream selection ternaries |
src/plugins/intel_cpu/src/cpu_memory.cpp | Replaced clamp ternary with std::min /std::max |
src/plugins/intel_cpu/src/.clang-tidy | Re-enabled nested-conditional-operator check |
7bc7a7f
to
8cad289
Compare
7723bd6
to
718ccf2
Compare
5221909
to
56f8453
Compare
Pull Request is not mergeable
Details:
Tickets: