[all-commits] [llvm/llvm-project] 018066: [clangd] Add a tweak for filling in enumerators of...

Tadeo Kondrak via All-commits all-commits at lists.llvm.org
Mon Sep 28 04:37:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 018066d9475dac8d4b7a91bf967ea9231ff4b3f1
      https://github.com/llvm/llvm-project/commit/018066d9475dac8d4b7a91bf967ea9231ff4b3f1
  Author: Tadeo Kondrak <me at tadeo.ca>
  Date:   2020-09-28 (Mon, 28 Sep 2020)

  Changed paths:
    M clang-tools-extra/clangd/refactor/tweaks/CMakeLists.txt
    A clang-tools-extra/clangd/refactor/tweaks/PopulateSwitch.cpp
    M clang-tools-extra/clangd/unittests/TweakTests.cpp

  Log Message:
  -----------
  [clangd] Add a tweak for filling in enumerators of a switch statement.

Add a tweak that populates an empty switch statement of an enumeration type with all of the enumerators of that type.

Before:
```
enum Color { RED, GREEN, BLUE };
void f(Color color) {
  switch (color) {}
}
```

After:
```
enum Color { RED, GREEN, BLUE };
void f(Color color) {
  switch (color) {
  case RED:
  case GREEN:
  case BLUE:
    break;
  }
}
```

Reviewed By: sammccall

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




More information about the All-commits mailing list