[clangd] ExtractFunction: disable on regions that sometimes, but not always return.
authorAdam Czachorowski <adamcz@google.com>
Tue, 1 Dec 2020 18:04:42 +0000 (19:04 +0100)
committerAdam Czachorowski <adamcz@google.com>
Tue, 8 Dec 2020 14:55:32 +0000 (15:55 +0100)
commitf6b205dae16392382324fbca676ef6afe3920642
tree0d7142c1deac6cad62650021392879bb09441035
parentdb61b1844e11f29a06d6dc4aab87ebb4f0aabfdd
[clangd] ExtractFunction: disable on regions that sometimes, but not always return.

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.

Differential Revision: https://reviews.llvm.org/D92408
clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
clang-tools-extra/clangd/unittests/TweakTests.cpp