@@ -285,10 +285,10 @@ static void emitOptionParser(const RecordKeeper &Records, raw_ostream &OS) {
285285 if (R.getValue (" SubCommands" ) != nullptr ) {
286286 std::vector<const Record *> SubCommands =
287287 R.getValueAsListOfDefs (" SubCommands" );
288- SubCommandKeyT CommandKey ;
288+ SubCommandKeyT SubCommandKey ;
289289 for (const auto &SubCommand : SubCommands)
290- CommandKey .push_back (SubCommand->getName ());
291- OS << SubCommandIDs[CommandKey ];
290+ SubCommandKey .push_back (SubCommand->getName ());
291+ OS << SubCommandIDs[SubCommandKey ];
292292 } else {
293293 // The option SubCommandIDsOffset (for default top level toolname is 0).
294294 OS << " 0" ;
@@ -299,10 +299,10 @@ static void emitOptionParser(const RecordKeeper &Records, raw_ostream &OS) {
299299 for (const Record &R : llvm::make_pointee_range (Opts)) {
300300 std::vector<const Record *> RSubCommands =
301301 R.getValueAsListOfDefs (" SubCommands" );
302- SubCommandKeyT CommandKey ;
302+ SubCommandKeyT SubCommandKey ;
303303 for (const auto &SubCommand : RSubCommands)
304- CommandKey .push_back (SubCommand->getName ());
305- SubCommandIDs.try_emplace (CommandKey , 0 );
304+ SubCommandKey .push_back (SubCommand->getName ());
305+ SubCommandIDs.try_emplace (SubCommandKey , 0 );
306306 }
307307
308308 DenseSet<StringRef> PrefixesUnionSet;
@@ -357,34 +357,35 @@ static void emitOptionParser(const RecordKeeper &Records, raw_ostream &OS) {
357357 OS << " \n };\n " ;
358358 OS << " #endif // OPTTABLE_PREFIXES_TABLE_CODE\n\n " ;
359359
360- // Dump command IDs.
360+ // Dump subcommand IDs.
361361 OS << " /////////" ;
362- OS << " // Command IDs\n\n " ;
362+ OS << " // SubCommand IDs\n\n " ;
363363 OS << " #ifdef OPTTABLE_SUBCOMMAND_IDS_TABLE_CODE\n " ;
364364 OS << " static constexpr unsigned OptionSubCommandIDsTable[] = {\n " ;
365365 {
366- // Ensure the first command set is always empty.
366+ // Ensure the first subcommand set is always empty.
367367 assert (!SubCommandIDs.empty () &&
368- " We should always emit an empty set of commands " );
368+ " We should always emit an empty set of subcommands " );
369369 assert (SubCommandIDs.begin ()->first .empty () &&
370- " First command set should always be empty" );
370+ " First subcommand set should always be empty" );
371371 llvm::ListSeparator Sep (" ,\n " );
372372 unsigned CurIndex = 0 ;
373- for (auto &[Command, CommandIndex] : SubCommandIDs) {
374- // First emit the number of command strings in this list of commands.
375- OS << Sep << " " << Command.size () << " /* commands */" ;
376- CommandIndex = CurIndex;
377- assert ((CurIndex == 0 || !Command.empty ()) &&
378- " Only first command set should be empty!" );
379- for (const auto &CommandKey : Command) {
373+ for (auto &[SubCommand, SubCommandIndex] : SubCommandIDs) {
374+ // First emit the number of subcommand strings in this list of
375+ // subcommands.
376+ OS << Sep << " " << SubCommand.size () << " /* subcommands */" ;
377+ SubCommandIndex = CurIndex;
378+ assert ((CurIndex == 0 || !SubCommand.empty ()) &&
379+ " Only first subcommand set should be empty!" );
380+ for (const auto &SubCommandKey : SubCommand) {
380381 auto It = std::find_if (
381382 SubCommands.begin (), SubCommands.end (),
382- [&](const Record *R) { return R->getName () == CommandKey ; });
383- assert (It != SubCommands.end () && " Command not found" );
383+ [&](const Record *R) { return R->getName () == SubCommandKey ; });
384+ assert (It != SubCommands.end () && " SubCommand not found" );
384385 OS << " , " << std::distance (SubCommands.begin (), It) << " /* '"
385- << CommandKey << " ' */" ;
386+ << SubCommandKey << " ' */" ;
386387 }
387- CurIndex += Command .size () + 1 ;
388+ CurIndex += SubCommand .size () + 1 ;
388389 }
389390 }
390391 OS << " \n };\n " ;
0 commit comments