[clang-tools-extra] [clangd] Consider expression statements in ExtractVariable tweak (PR #112525)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 10 00:18:35 PST 2024


================
@@ -423,8 +427,6 @@ bool childExprIsStmt(const Stmt *Outer, const Expr *Inner) {
   if (!Outer || !Inner)
     return false;
   // Exclude the most common places where an expr can appear but be unused.
-  if (llvm::isa<CompoundStmt>(Outer))
----------------
HighCommander4 wrote:

We should revise the name of this function from `childExprIsStmt`, which is no longer accurate, to something like `childExprIsDisallowedStmt`, and update the [comment at the call site](https://searchfox.org/llvm/rev/7831c5e4831963425279db7b1c4d23cfa9da9674/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp#479-480) to talk about what kind of statements we allow extracting and what kind we don't.

https://github.com/llvm/llvm-project/pull/112525


More information about the cfe-commits mailing list