This is an archive of the discontinued LLVM Phabricator instance.

[clangd] ExtractFunction: disable on regions that sometimes, but not always return.
ClosedPublic

Authored by adamcz on Dec 1 2020, 10:24 AM.

Details

Summary

apply() will fail in those cases, so it's better to detect it in
prepare() already and hide code action from the user.

This was especially annoying on code bases that use a lot of
RETURN_IF_ERROR-like macros.

Diff Detail

Event Timeline

adamcz created this revision.Dec 1 2020, 10:24 AM
adamcz requested review of this revision.Dec 1 2020, 10:24 AM
usaxena95 accepted this revision.Dec 5 2020, 4:29 AM
usaxena95 added inline comments.
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
711

s/ReturnStms/ReturnStmts

clang-tools-extra/clangd/unittests/TweakTests.cpp
613

super super nit: !x instead of x.

This revision is now accepted and ready to land.Dec 5 2020, 4:29 AM
usaxena95 added inline comments.Dec 7 2020, 12:49 AM
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
724

nit: s/auto/Stmt

clang-tools-extra/clangd/unittests/TweakTests.cpp
613

Oops this is fine. Ignore this comment.

adamcz updated this revision to Diff 309958.Dec 7 2020, 10:51 AM
adamcz marked 2 inline comments as done.

addressed review comments

This revision was landed with ongoing or failed builds.Dec 8 2020, 6:56 AM
This revision was automatically updated to reflect the committed changes.