[clangd] support expanding `decltype(expr)`
authorv1nh1shungry <v1nh1shungry@outlook.com>
Fri, 13 Jan 2023 02:15:13 +0000 (03:15 +0100)
committerSam McCall <sam.mccall@gmail.com>
Fri, 13 Jan 2023 02:26:33 +0000 (03:26 +0100)
commit1feb7af046889728233e67e3163ab30020207bb2
treec5a5a00420b585884133f786d7456d6e37f6f6a2
parent1eaadaea5090f88d4e26331a5046a1a07f15a6ea
[clangd] support expanding `decltype(expr)`

Enable the existing tweak `ExpandAutoType` to expand
`decltype(expr)`, e.g.

```
decltype(0) i;
```

will expand to

```
int i;
```

Therefore, rename the tweak `ExpandAutoType` to `ExpandDeducedType`.

This patch also fixes some nits,

* avoid replacing reference to a function
* avoid replacing array types and reference to an array

Fixes https://github.com/clangd/clangd/issues/1456

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D141226
13 files changed:
clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp [moved from clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp with 64% similarity]
clang-tools-extra/clangd/test/check-fail.test
clang-tools-extra/clangd/test/check-lines.test
clang-tools-extra/clangd/test/check.test
clang-tools-extra/clangd/test/code-action-request.test
clang-tools-extra/clangd/test/request-reply.test
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp [moved from clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp with 54% similarity]
clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
clang/docs/tools/clang-formatted-files.txt
llvm/utils/gn/secondary/clang-tools-extra/clangd/refactor/tweaks/BUILD.gn
llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn