kadircet accepted this revision. kadircet marked an inline comment as done. kadircet added a comment. This revision is now accepted and ready to land.
LGTM, thanks! ================ Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:173 +bool alwaysReturns(const ExtractionZone &EZ) { + const Stmt *Last = EZ.Parent->Children.back()->ASTNode.get<Stmt>(); + // Unwrap enclosing (unconditional) compound statement. ---------------- `EZ.getLastRootStmt()` instead of `EZ.Parent->Children.back()` ================ Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:175 + // Unwrap enclosing (unconditional) compound statement. + while (const auto *CS = llvm::dyn_cast<CompoundStmt>(Last)) + if (CS->body_empty()) ---------------- nit: braces ================ Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:180 + Last = CS->body_back(); + return llvm::isa<ReturnStmt>(Last); +} ---------------- what if there's a goto in the selection :P ================ Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:611 + // (Others are possible if there are conversions, but this seems clearest). + if (CapturedInfo.HasReturnStmt) { + // If the return is conditional, neither replacing the code with ---------------- nit: early exits Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70569/new/ https://reviews.llvm.org/D70569 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits