[PATCH] D110954: [clangd] Improve PopulateSwitch tweak

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 1 13:21:44 PDT 2021


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: clang-tools-extra/clangd/refactor/tweaks/PopulateSwitch.cpp:178
 
-    // Unsure if this case could ever come up, but prevents an unreachable
-    // executing in getResultAsAPSInt.
+    // We need a storage kind in order to be able to fetch the value type,
+    // currently both C and ObjC enums will return none.
----------------
"we need a storage kind" doesn't seem quite right, rather "we need a stored value"


================
Comment at: clang-tools-extra/clangd/unittests/tweaks/PopulateSwitchTests.cpp:210
       },
+      {// C: Only filling in missing enumerators
+       Function,
----------------
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)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110954/new/

https://reviews.llvm.org/D110954



More information about the cfe-commits mailing list