[clangd] ExtractVariable support for C and Objective-C
authorDavid Goldman <davg@google.com>
Tue, 26 Apr 2022 19:30:50 +0000 (15:30 -0400)
committerDavid Goldman <davg@google.com>
Tue, 31 May 2022 15:14:51 +0000 (11:14 -0400)
commitae67984ca6d89c7ccdbdca258cd05c151d8b6431
treea1c4e741e8901284c43a0d655fcc9359a3b6fca0
parentaf0113cf77b3df93495182507cb41e54927188c7
[clangd] ExtractVariable support for C and Objective-C

- Use the expression's type for non-C++ as the variable type. This works
  well, but might not preserve the typedefs due to type
  canonicalization.

- Improve support for Objective-C property references which are
  represented using `ObjCPropertyRefExpr` and `BuiltinType::PseudoObject`.

Differential Revision: https://reviews.llvm.org/D124486
clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp