[2/N] Fix cppcoreguidelines-init-variables suppression (#146237)

This PR removes all `cppcoreguidelines-init-variables` suppressions.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/146237
Approved by: https://github.com/ezyang
This commit is contained in:
cyy
2025-06-19 23:26:42 +00:00
committed by PyTorch MergeBot
parent 52f873adc2
commit 3c2324c64a
18 changed files with 28 additions and 134 deletions

View File

@ -19,8 +19,7 @@ TEST(SubgraphUtilsTest, Basic) {
for (bool reverse_iterate : {true, false}) {
// Merge everything into a single subgraph
bool first = true;
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
Node* subgraph;
Node* subgraph = nullptr;
auto it =
reverse_iterate ? graph->nodes().rbegin() : graph->nodes().begin();
auto end = reverse_iterate ? graph->nodes().rend() : graph->nodes().end();
@ -84,8 +83,7 @@ graph(%a : Tensor, %b : Tensor, %c : Tensor):
while (graph2->next() != *graph->nodes().end()) {
SubgraphUtils::mergeNodeIntoSubgraph(graph2->next(), graph2);
}
// NOLINTNEXTLINE(cppcoreguidelines-init-variables)
Node* subgraph;
Node* subgraph = nullptr;
if (reverse_merge) {
SubgraphUtils::mergeNodeIntoSubgraph(graph2, graph1);
subgraph = graph1;