[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


================
@@ -599,10 +607,22 @@ Expected<Tweak::Effect> ExtractVariable::apply(const Selection &Inputs) {
   // FIXME: get variable name from user or suggest based on type
   std::string VarName = "placeholder";
   SourceRange Range = Target->getExtractionChars();
+
+  const SelectionTree::Node &OuterImplicit =
+      Target->getExprNode()->outerImplicit();
+  assert(OuterImplicit.Parent);
+  bool IsStmtExpr = llvm::isa_and_nonnull<CompoundStmt>(
----------------
HighCommander4 wrote:

s/StmtExpr/ExprStmt

("statement expressions" are [something different](https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html))

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


More information about the cfe-commits mailing list