[clangd] Refactor computation of extracted expr in ExtractVariable tweak. NFC
authorSam McCall <sam.mccall@gmail.com>
Mon, 12 Aug 2019 17:05:35 +0000 (17:05 +0000)
committerSam McCall <sam.mccall@gmail.com>
Mon, 12 Aug 2019 17:05:35 +0000 (17:05 +0000)
commit6a3c2c84be2b319e4aa893e6b3440eedc27ab3a6
treeae9ca4505f3d0cf493f4d60643db4e830bf1634d
parent3e39f39ad929f0b6630ecb59b717fd6ae0702c76
[clangd] Refactor computation of extracted expr in ExtractVariable tweak. NFC

Summary:
This takes this logic out of the Tweak class, and simplifies the signature of
the function where the main logic is.

The goal is to make it easier to turn into a loop like:

  for (current = N; current and current->parent are both expr; current = current->parent)
    if (suitable(current))
      return current;
  return null;

Reviewers: SureYeaah

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 368590
clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp