[llvm] [Support] Use range-based for loops (NFC) (PR #169001)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 08:24:59 PST 2025


================
@@ -602,8 +602,7 @@ static Option *LookupNearestOption(StringRef Arg,
   // Find the closest match.
   Option *Best = nullptr;
   unsigned BestDistance = 0;
-  for (const auto &Opt : OptionsMap) {
-    Option *O = Opt.second;
+  for (const auto &[Key, O] : OptionsMap) {
----------------
kazutakahirata wrote:

How about `_`, which has become "name-independent placeholder" in C++26?  `Key` is a last-resort name anyway.  `Name` would be shadowed a few lines later.  `OptionName` would be too close to `OptionNames`.  I wasn't able to come up with a meaningful name.

https://github.com/llvm/llvm-project/pull/169001


More information about the llvm-commits mailing list