kbobyrev added inline comments.
================ Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:339 + if (const auto *If = ParentNode->get<IfStmt>()) + if (const auto *Then = dyn_cast<CompoundStmt>(If->getThen())) + EnclosingScope = Then; ---------------- hokein wrote: > thinking more about the `if` case, I think else should be included as well? > no need to address in this patch. > > like > > ``` > if (int a = 0) { > } else { > int s; // rename s=>a will cause a compiling error. > } > ``` This case is already supported: `else`'s `CompoundStmt` is attached to the same `IfStmt` with variable declaration and is checked just like the "main" branch. The other one wasn't (renaming `a` into `s`) but I've added this and also added tests for this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D95925/new/ https://reviews.llvm.org/D95925 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits