[all-commits] [llvm/llvm-project] 2ff449: [clangd] Reduce availability of extract function

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Fri Oct 9 01:16:43 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ff44935a5f56f755a4f47ad00ee0dec48e19832
      https://github.com/llvm/llvm-project/commit/2ff44935a5f56f755a4f47ad00ee0dec48e19832
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2020-10-09 (Fri, 09 Oct 2020)

  Changed paths:
    M clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
    M clang-tools-extra/clangd/unittests/TweakTests.cpp

  Log Message:
  -----------
  [clangd] Reduce availability of extract function

This patch introduces hoisting detection logic into prepare state with
a partial AST traversal of the enclosing function.

We had some complaints from the users about this code action being almost always
available but failing most of the time. Hopefully this should reduce that noise.

The latency/correctness tradeoff is a bunch of hand-waving, but at least today
we don't have any other actions that are available on selection of statements,
so when we get to do the traversal it is quite likely that all the other checks
will bail out early. But this is still up for discussion, I am happy to abandon
the patch if you believe this is not practical.

Differential Revision: https://reviews.llvm.org/D85354




More information about the All-commits mailing list