[all-commits] [llvm/llvm-project] 1feb7a: [clangd] support expanding `decltype(expr)`

v1nh1shungry via All-commits all-commits at lists.llvm.org
Thu Jan 12 18:27:32 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1feb7af046889728233e67e3163ab30020207bb2
      https://github.com/llvm/llvm-project/commit/1feb7af046889728233e67e3163ab30020207bb2
  Author: v1nh1shungry <v1nh1shungry at outlook.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
    R clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
    A clang-tools-extra/clangd/refactor/tweaks/ExpandDeducedType.cpp
    M clang-tools-extra/clangd/test/check-fail.test
    M clang-tools-extra/clangd/test/check-lines.test
    M clang-tools-extra/clangd/test/check.test
    M clang-tools-extra/clangd/test/code-action-request.test
    M clang-tools-extra/clangd/test/request-reply.test
    M clang-tools-extra/clangd/unittests/CMakeLists.txt
    R clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp
    A clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp
    M clang-tools-extra/clangd/unittests/tweaks/TweakTesting.h
    M clang/docs/tools/clang-formatted-files.txt
    M llvm/utils/gn/secondary/clang-tools-extra/clangd/refactor/tweaks/BUILD.gn
    M llvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn

  Log Message:
  -----------
  [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




More information about the All-commits mailing list