This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Improve PopulateSwitch tweak
ClosedPublic

Authored by dgoldman on Oct 1 2021, 11:49 AM.

Details

Summary
  • Support enums in C and ObjC as their AST representations differ slightly.
  • Add support for typedef'ed enums.

Event Timeline

dgoldman created this revision.Oct 1 2021, 11:49 AM
dgoldman requested review of this revision.Oct 1 2021, 11:49 AM
sammccall accepted this revision.Oct 1 2021, 1:21 PM

Thanks!

clang-tools-extra/clangd/refactor/tweaks/PopulateSwitch.cpp
178

"we need a storage kind" doesn't seem quite right, rather "we need a stored value"

clang-tools-extra/clangd/unittests/tweaks/PopulateSwitchTests.cpp
210

There's nothing ObjC-specific about these tests, I don't think we should duplicate them between C and ObjC.

(Unlike C vs C++, it's very rare for plain-c code to have different semantics in ObjC)

This revision is now accepted and ready to land.Oct 1 2021, 1:21 PM
dgoldman updated this revision to Diff 376635.Oct 1 2021, 2:23 PM
dgoldman marked an inline comment as done.

Minor fixes for review

dgoldman marked an inline comment as done.Oct 1 2021, 2:25 PM
This revision was automatically updated to reflect the committed changes.