@@ -2313,8 +2313,8 @@ class HelpPrinter {
2313
2313
StrSubCommandPairVector;
2314
2314
// Print the options. Opts is assumed to be alphabetically sorted.
2315
2315
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);
2318
2318
}
2319
2319
2320
2320
void printSubCommands (StrSubCommandPairVector &Subs, size_t MaxSubLen) {
@@ -2384,8 +2384,8 @@ class HelpPrinter {
2384
2384
if (Sub == &SubCommand::getTopLevel () && !Subs.empty ()) {
2385
2385
// Compute the maximum subcommand length...
2386
2386
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 ));
2389
2389
2390
2390
outs () << " \n\n " ;
2391
2391
outs () << " SUBCOMMANDS:\n\n " ;
@@ -2400,8 +2400,8 @@ class HelpPrinter {
2400
2400
2401
2401
// Compute the maximum argument length...
2402
2402
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 ());
2405
2405
2406
2406
outs () << " OPTIONS:\n " ;
2407
2407
printOptions (Opts, MaxArgLen);
@@ -2447,9 +2447,9 @@ class CategorizedHelpPrinter : public HelpPrinter {
2447
2447
// Walk through pre-sorted options and assign into categories.
2448
2448
// Because the options are already alphabetically sorted the
2449
2449
// 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 ) {
2453
2453
assert (llvm::is_contained (SortedCategories, Cat) &&
2454
2454
" Option has an unregistered category" );
2455
2455
CategorizedOptions[Cat].push_back (Opt);
@@ -2708,11 +2708,11 @@ void CommandLineParser::printOptionValues() {
2708
2708
2709
2709
// Compute the maximum argument length...
2710
2710
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 ());
2713
2713
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 );
2716
2716
}
2717
2717
2718
2718
// Utility function for printing the help message.
0 commit comments