We only do a trivial check whether the region always returns - it has to end
with a return statement.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Build result: pass - 60231 tests passed, 0 failed and 732 were skipped.
Log files: console-log.txt, CMakeCache.txt
Build result: pass - 60231 tests passed, 0 failed and 732 were skipped.
Log files: console-log.txt, CMakeCache.txt
btw forgot to add a comment, it might be worth mentioning in change description that, this works in its current state because we don't allow extractions inside lambda expressions.
(Thanks! Will address comments, just wanted to ask for a clarification)
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp | ||
---|---|---|
180 | If the goto target is in the selection, that's fine. Otherwise it's broken control flow like break/continue. It doesn't seem to be detected yet indeed. | |
611 | I'm not sure what this comment means, can you elaborate? |
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp | ||
---|---|---|
611 | ah sorry, i was trying to imply usage of early exits in the code, i.e: ExtractedFunc.ReturnType = EnclosingFunc.getParentASTContext().VoidTy; if not HasReturnStmt return true; if not AlwaysReturn return false; . . . |
EZ.getLastRootStmt() instead of EZ.Parent->Children.back()