[PATCH] D68182: [Clangd] Ensure children are always RootStmt in ExtractFunction (Fixes #153)
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 1 03:04:22 PDT 2019
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:110
// begins in selection range, ends in selection range and any scope that begins
// outside the selection range, ends outside as well.
const Node *getParentOfRootStmts(const Node *CommonAnc) {
----------------
can you also update the comment to mention
`returns null if any child of the parent is not a root statement`
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:111
// outside the selection range, ends outside as well.
const Node *getParentOfRootStmts(const Node *CommonAnc) {
if (!CommonAnc)
----------------
can we restructure this into:
```
if (!CommonAnc) return nullptr;
const Node *Parent = nullptr;
switch(...) {
...Fill In Parent...
default:
llvm_unreachable(..)
}
return llvm::all_of(..)
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68182/new/
https://reviews.llvm.org/D68182
More information about the cfe-commits
mailing list