@@ -2313,8 +2313,8 @@ class HelpPrinter {
23132313 StrSubCommandPairVector;
23142314 // Print the options. Opts is assumed to be alphabetically sorted.
23152315 virtual void printOptions (StrOptionPairVector &Opts, size_t MaxArgLen) {
2316- for (size_t i = 0 , e = Opts. size (); i != e; ++i )
2317- Opts[i] .second ->printOptionInfo (MaxArgLen);
2316+ for (const auto &Opt : Opts)
2317+ Opt .second ->printOptionInfo (MaxArgLen);
23182318 }
23192319
23202320 void printSubCommands (StrSubCommandPairVector &Subs, size_t MaxSubLen) {
@@ -2384,8 +2384,8 @@ class HelpPrinter {
23842384 if (Sub == &SubCommand::getTopLevel () && !Subs.empty ()) {
23852385 // Compute the maximum subcommand length...
23862386 size_t MaxSubLen = 0 ;
2387- for (size_t i = 0 , e = Subs. size (); i != e; ++i )
2388- MaxSubLen = std::max (MaxSubLen, strlen (Subs[i] .first ));
2387+ for (const auto &Sub : Subs)
2388+ MaxSubLen = std::max (MaxSubLen, strlen (Sub .first ));
23892389
23902390 outs () << " \n\n " ;
23912391 outs () << " SUBCOMMANDS:\n\n " ;
@@ -2400,8 +2400,8 @@ class HelpPrinter {
24002400
24012401 // Compute the maximum argument length...
24022402 size_t MaxArgLen = 0 ;
2403- for (size_t i = 0 , e = Opts. size (); i != e; ++i )
2404- MaxArgLen = std::max (MaxArgLen, Opts[i] .second ->getOptionWidth ());
2403+ for (const auto &Opt : Opts)
2404+ MaxArgLen = std::max (MaxArgLen, Opt .second ->getOptionWidth ());
24052405
24062406 outs () << " OPTIONS:\n " ;
24072407 printOptions (Opts, MaxArgLen);
@@ -2447,9 +2447,9 @@ class CategorizedHelpPrinter : public HelpPrinter {
24472447 // Walk through pre-sorted options and assign into categories.
24482448 // Because the options are already alphabetically sorted the
24492449 // options within categories will also be alphabetically sorted.
2450- for (size_t I = 0 , E = Opts. size (); I != E; ++I ) {
2451- Option *Opt = Opts[I] .second ;
2452- for (auto & Cat : Opt->Categories ) {
2450+ for (const auto &I : Opts ) {
2451+ Option *Opt = I .second ;
2452+ for (OptionCategory * Cat : Opt->Categories ) {
24532453 assert (llvm::is_contained (SortedCategories, Cat) &&
24542454 " Option has an unregistered category" );
24552455 CategorizedOptions[Cat].push_back (Opt);
@@ -2708,11 +2708,11 @@ void CommandLineParser::printOptionValues() {
27082708
27092709 // Compute the maximum argument length...
27102710 size_t MaxArgLen = 0 ;
2711- for (size_t i = 0 , e = Opts. size (); i != e; ++i )
2712- MaxArgLen = std::max (MaxArgLen, Opts[i] .second ->getOptionWidth ());
2711+ for (const auto &Opt : Opts)
2712+ MaxArgLen = std::max (MaxArgLen, Opt .second ->getOptionWidth ());
27132713
2714- for (size_t i = 0 , e = Opts. size (); i != e; ++i )
2715- Opts[i] .second ->printOptionValue (MaxArgLen, CommonOptions->PrintAllOptions );
2714+ for (const auto &Opt : Opts)
2715+ Opt .second ->printOptionValue (MaxArgLen, CommonOptions->PrintAllOptions );
27162716}
27172717
27182718// Utility function for printing the help message.
0 commit comments