LLVM: lib/Option/OptTable.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

21#include

22#include

23#include

24#include

25#include

26#include

27#include

28#include

29

30using namespace llvm;

32

33namespace {

34struct OptNameLess {

37

38 explicit OptNameLess(const StringTable &StrTable,

40 : StrTable(&StrTable), PrefixesTable(PrefixesTable) {}

41

42#ifndef NDEBUG

43 inline bool operator()(const OptTable::Info &A,

44 const OptTable::Info &B) const {

45 if (&A == &B)

46 return false;

47

48 if (int Cmp = StrCmpOptionName(A.getName(*StrTable, PrefixesTable),

49 B.getName(*StrTable, PrefixesTable)))

50 return Cmp < 0;

51

53 A.appendPrefixes(*StrTable, PrefixesTable, APrefixes);

54 B.appendPrefixes(*StrTable, PrefixesTable, BPrefixes);

55

57 return Cmp < 0;

58

59

60

63 "Unexpected classes for options with same name.");

65 }

66#endif

67

68

69 inline bool operator()(const OptTable::Info &I, StringRef Name) const {

70

71 return StrCmpOptionName(I.getName(*StrTable, PrefixesTable), Name, false) <

72 0;

73 }

74};

75}

76

78

84 : StrTable(&StrTable), PrefixesTable(PrefixesTable),

85 OptionInfos(OptionInfos), IgnoreCase(IgnoreCase),

86 SubCommands(SubCommands), SubCommandIDsTable(SubCommandIDsTable) {

87

88

89

90

91 for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {

92 unsigned Kind = getInfo(i + 1).Kind;

94 assert(!InputOptionID && "Cannot have multiple input options!");

95 InputOptionID = getInfo(i + 1).ID;

97 assert(!UnknownOptionID && "Cannot have multiple unknown options!");

98 UnknownOptionID = getInfo(i + 1).ID;

101 break;

102 }

103 }

105

106#ifndef NDEBUG

107

108

113 "Special options should be defined first!");

114 }

115

116

118 if (!(OptNameLess(StrTable, PrefixesTable)(getInfo(i), getInfo(i + 1)))) {

122 }

123 }

124#endif

125}

126

128 assert(PrefixChars.empty() && "rebuilding a non-empty prefix char");

129

130

132 for (char C : Prefix)

135 }

136}

137

139

141 unsigned id = Opt.getID();

142 if (id == 0)

143 return Option(nullptr, nullptr);

145 return Option(&getInfo(id), this);

146}

147

149 if (Arg == "-")

150 return true;

151 for (const StringRef &Prefix : Prefixes)

152 if (Arg.starts_with(Prefix))

153 return false;

154 return true;

155}

156

157

161 bool IgnoreCase) {

162 StringRef Name = I->getName(StrTable, PrefixesTable);

163 for (auto PrefixOffset : I->getPrefixOffsets(PrefixesTable)) {

164 StringRef Prefix = StrTable[PrefixOffset];

165 if (Str.starts_with(Prefix)) {

169 if (Matched)

170 return Prefix.size() + Name.size();

171 }

172 }

173 return 0;

174}

175

176

180 StringRef Name = In.getName(StrTable, PrefixesTable);

181 if (Option.consume_back(Name))

182 for (auto PrefixOffset : In.getPrefixOffsets(PrefixesTable))

183 if (Option == StrTable[PrefixOffset])

184 return true;

185 return false;

186}

187

188

189

190

191std::vectorstd::string

193

195 const Info &In = OptionInfos[I];

197 continue;

198

200 StringRef(In.Values).split(Candidates, ",", -1, false);

201

202 std::vectorstd::string Result;

204 if (Val.starts_with(Arg) && Arg != Val)

205 Result.push_back(std::string(Val));

206 return Result;

207 }

208 return {};

209}

210

211std::vectorstd::string

213 unsigned int DisableFlags) const {

214 std::vectorstd::string Ret;

216 const Info &In = OptionInfos[I];

217 if (In.hasNoPrefix() || (!In.HelpText && !In.GroupID))

218 continue;

219 if (!(In.Visibility & VisibilityMask))

220 continue;

221 if (In.Flags & DisableFlags)

222 continue;

223

224 StringRef Name = In.getName(*StrTable, PrefixesTable);

225 for (auto PrefixOffset : In.getPrefixOffsets(PrefixesTable)) {

226 StringRef Prefix = (*StrTable)[PrefixOffset];

227 std::string S = (Twine(Prefix) + Name + "\t").str();

228 if (In.HelpText)

229 S += In.HelpText;

231 Ret.push_back(S);

232 }

233 }

234 return Ret;

235}

236

239 unsigned MinimumLength,

240 unsigned MaximumDistance) const {

241 return internalFindNearest(

242 Option, NearestString, MinimumLength, MaximumDistance,

243 [VisibilityMask](const Info &CandidateInfo) {

244 return (CandidateInfo.Visibility & VisibilityMask) == 0;

245 });

246}

247

249 unsigned FlagsToInclude, unsigned FlagsToExclude,

250 unsigned MinimumLength,

251 unsigned MaximumDistance) const {

252 return internalFindNearest(

253 Option, NearestString, MinimumLength, MaximumDistance,

254 [FlagsToInclude, FlagsToExclude](const Info &CandidateInfo) {

255 if (FlagsToInclude && !(CandidateInfo.Flags & FlagsToInclude))

256 return true;

257 if (CandidateInfo.Flags & FlagsToExclude)

258 return true;

259 return false;

260 });

261}

262

263unsigned OptTable::internalFindNearest(

264 StringRef Option, std::string &NearestString, unsigned MinimumLength,

265 unsigned MaximumDistance,

266 std::function<bool(const Info &)> ExcludeOption) const {

268

269

270

271 unsigned BestDistance =

272 MaximumDistance == UINT_MAX ? UINT_MAX : MaximumDistance + 1;

275

276 for (const Info &CandidateInfo :

278 StringRef CandidateName = CandidateInfo.getName(*StrTable, PrefixesTable);

279

280

281

282

283 if (CandidateName.size() < MinimumLength)

284 continue;

285

286

287 if (ExcludeOption(CandidateInfo))

288 continue;

289

290

291

292 if (CandidateInfo.hasNoPrefix())

293 continue;

294

295

296

297

298 char Last = CandidateName.back();

299 bool CandidateHasDelimiter = Last == '=' || Last == ':';

301 if (CandidateHasDelimiter) {

302 std::tie(NormalizedName, RHS) = Option.split(Last);

304 NormalizedName += Last;

305 } else

306 NormalizedName = Option;

307

308

309

310

311 for (auto CandidatePrefixOffset :

312 CandidateInfo.getPrefixOffsets(PrefixesTable)) {

313 StringRef CandidatePrefix = (*StrTable)[CandidatePrefixOffset];

314

315

316

317

318 size_t CandidateSize = CandidatePrefix.size() + CandidateName.size(),

319 NormalizedSize = NormalizedName.size();

320 size_t AbsDiff = CandidateSize > NormalizedSize

321 ? CandidateSize - NormalizedSize

322 : NormalizedSize - CandidateSize;

323 if (AbsDiff > BestDistance) {

324 continue;

325 }

326 Candidate = CandidatePrefix;

327 Candidate += CandidateName;

329 NormalizedName, true,

330 BestDistance);

331 if (RHS.empty() && CandidateHasDelimiter) {

332

333

334

335

336

337

338 ++Distance;

339 }

340 if (Distance < BestDistance) {

341 BestDistance = Distance;

342 NearestString = (Candidate + RHS).str();

343 }

344 }

345 }

346 return BestDistance;

347}

348

349

350

351

352

353std::unique_ptr OptTable::parseOneArgGrouped(InputArgList &Args,

354 unsigned &Index) const {

355

356

357 const char *CStr = Args.getArgString(Index);

358 StringRef Str(CStr);

360 return std::make_unique(getOption(InputOptionID), Str, Index++, CStr);

361

362 const Info *End = OptionInfos.data() + OptionInfos.size();

366 OptNameLess(*StrTable, PrefixesTable));

368 unsigned Prev = Index;

369

370

372 unsigned ArgSize =

373 matchOption(*StrTable, PrefixesTable, Start, Str, IgnoreCase);

374 if (!ArgSize)

375 continue;

376

377 Option Opt(Start, this);

378 if (std::unique_ptr A =

379 Opt.accept(Args, StringRef(Args.getArgString(Index), ArgSize),

380 false, Index))

381 return A;

382

383

384

385

388

389

390 if (Prev != Index)

391 return nullptr;

392 }

395

396 if (Str[2] == '=')

397 return std::make_unique(getOption(UnknownOptionID), Str, Index++,

398 CStr);

399

400 if (std::unique_ptr A = Opt.accept(

401 Args, Str.substr(0, 2), true, Index)) {

402 Args.replaceArgString(Index, Twine('-') + Str.substr(2));

403 return A;

404 }

405 }

406

407

408

409 if (Str[1] != '-') {

410 CStr = Args.MakeArgString(Str.substr(0, 2));

411 Args.replaceArgString(Index, Twine('-') + Str.substr(2));

412 return std::make_unique(getOption(UnknownOptionID), CStr, Index, CStr);

413 }

414

415 return std::make_unique(getOption(UnknownOptionID), Str, Index++, CStr);

416}

417

420 return internalParseOneArg(Args, Index, [VisibilityMask](const Option &Opt) {

422 });

423}

424

426 unsigned FlagsToInclude,

427 unsigned FlagsToExclude) const {

428 return internalParseOneArg(

429 Args, Index, [FlagsToInclude, FlagsToExclude](const Option &Opt) {

430 if (FlagsToInclude && !Opt.hasFlag(FlagsToInclude))

431 return true;

432 if (Opt.hasFlag(FlagsToExclude))

433 return true;

434 return false;

435 });

436}

437

438std::unique_ptr OptTable::internalParseOneArg(

439 const ArgList &Args, unsigned &Index,

440 std::function<bool(const Option &)> ExcludeOption) const {

441 unsigned Prev = Index;

442 StringRef Str = Args.getArgString(Index);

443

444

445

447 return std::make_unique(getOption(InputOptionID), Str, Index++,

448 Str.data());

449

451 const Info *End = OptionInfos.data() + OptionInfos.size();

453

454

455 Start =

456 std::lower_bound(Start, End, Name, OptNameLess(*StrTable, PrefixesTable));

457

458

459

460

461

462

463

464

465

466 for (; Start != End; ++Start) {

467 unsigned ArgSize = 0;

468

469 for (; Start != End; ++Start)

470 if ((ArgSize =

471 matchOption(*StrTable, PrefixesTable, Start, Str, IgnoreCase)))

472 break;

473 if (Start == End)

474 break;

475

476 Option Opt(Start, this);

477

478 if (ExcludeOption(Opt))

479 continue;

480

481

482 if (std::unique_ptr A =

483 Opt.accept(Args, StringRef(Args.getArgString(Index), ArgSize),

484 false, Index))

485 return A;

486

487

488 if (Prev != Index)

489 return nullptr;

490 }

491

492

493

494 if (Str[0] == '/')

495 return std::make_unique(getOption(InputOptionID), Str, Index++,

496 Str.data());

497

498 return std::make_unique(getOption(UnknownOptionID), Str, Index++,

499 Str.data());

500}

501

503 unsigned &MissingArgIndex,

504 unsigned &MissingArgCount,

506 return internalParseArgs(

507 Args, MissingArgIndex, MissingArgCount,

508 [VisibilityMask](const Option &Opt) {

510 });

511}

512

514 unsigned &MissingArgIndex,

515 unsigned &MissingArgCount,

516 unsigned FlagsToInclude,

517 unsigned FlagsToExclude) const {

518 return internalParseArgs(

519 Args, MissingArgIndex, MissingArgCount,

520 [FlagsToInclude, FlagsToExclude](const Option &Opt) {

521 if (FlagsToInclude && !Opt.hasFlag(FlagsToInclude))

522 return true;

523 if (Opt.hasFlag(FlagsToExclude))

524 return true;

525 return false;

526 });

527}

528

531 unsigned &MissingArgCount,

532 std::function<bool(const Option &)> ExcludeOption) const {

534

535

536

537 MissingArgIndex = MissingArgCount = 0;

538 unsigned Index = 0, End = ArgArr.size();

539 while (Index < End) {

540

541 if (Args.getArgString(Index) == nullptr) {

542 ++Index;

543 continue;

544 }

545

546 StringRef Str = Args.getArgString(Index);

547 if (Str == "") {

548 ++Index;

549 continue;

550 }

551

552

553

554 if (DashDashParsing && Str == "--") {

555 while (++Index < End) {

556 Args.append(new Arg(getOption(InputOptionID), Str, Index,

557 Args.getArgString(Index)));

558 }

559 break;

560 }

561

562 unsigned Prev = Index;

563 std::unique_ptr A = GroupedShortOptions

564 ? parseOneArgGrouped(Args, Index)

565 : internalParseOneArg(Args, Index, ExcludeOption);

566 assert((Index > Prev || GroupedShortOptions) &&

567 "Parser failed to consume argument.");

568

569

570 if (A) {

571 assert(Index >= End && "Unexpected parser error.");

572 assert(Index - Prev - 1 && "No missing arguments!");

573 MissingArgIndex = Prev;

574 MissingArgCount = Index - Prev - 1;

575 break;

576 }

577

578 Args.append(A.release());

579 }

580

582}

583

586 std::function<void(StringRef)> ErrorFn) const {

588

589

591

592 unsigned MAI, MAC;

594 if (MAC)

595 ErrorFn((Twine(Args.getArgString(MAI)) + ": missing argument").str());

596

597

598

599 std::string Nearest;

601 std::string Spelling = A->getAsString(Args);

603 ErrorFn("unknown argument '" + Spelling + "'");

604 else

605 ErrorFn("unknown argument '" + Spelling + "', did you mean '" + Nearest +

606 "'?");

607 }

608 return Args;

609}

610

613 std::string Name = O.getPrefixedName().str();

614

615

616 switch (O.getKind()) {

619

622

623 Name += ' ';

624 Name += MetaVarName;

625 }

626 else {

627

628 for (unsigned i=0, e=O.getNumArgs(); i< e; ++i) {

629 Name += " ";

630 }

631 }

632 break;

633

635 break;

636

638 break;

639

642 Name += ' ';

643 [[fallthrough]];

647 Name += MetaVarName;

648 else

649 Name += "";

650 break;

651 }

652

653 return Name;

654}

655

656namespace {

657struct OptionInfo {

658 std::string Name;

659 StringRef HelpText;

660};

661}

662

664 std::vector &OptionHelp) {

665 OS << Title << ":\n";

666

667

668 unsigned OptionFieldWidth = 0;

669 for (const OptionInfo &Opt : OptionHelp) {

670

671 unsigned Length = Opt.Name.size();

673 OptionFieldWidth = std::max(OptionFieldWidth, Length);

674 }

675

676 const unsigned InitialPad = 2;

677 for (const OptionInfo &Opt : OptionHelp) {

678 const std::string &Option = Opt.Name;

679 int Pad = OptionFieldWidth + InitialPad;

680 int FirstLinePad = OptionFieldWidth - int(Option.size());

682

683

684 if (FirstLinePad < 0) {

685 OS << "\n";

686 FirstLinePad = OptionFieldWidth + InitialPad;

687 Pad = FirstLinePad;

688 }

689

691 Opt.HelpText.split(Lines, '\n');

692 assert(Lines.size() && "Expected at least the first line in the help text");

693 auto *LinesIt = Lines.begin();

694 OS.indent(FirstLinePad + 1) << *LinesIt << '\n';

695 while (Lines.end() != ++LinesIt)

696 OS.indent(Pad + 1) << *LinesIt << '\n';

697 }

698}

699

702

703

704 if (!GroupID)

705 return "OPTIONS";

706

707

708

709

710

712 return GroupHelp;

713

714

716}

717

719 bool ShowHidden, bool ShowAllAliases,

722 return internalPrintHelp(

723 OS, Usage, Title, SubCommand, ShowHidden, ShowAllAliases,

724 [VisibilityMask](const Info &CandidateInfo) -> bool {

725 return (CandidateInfo.Visibility & VisibilityMask) == 0;

726 },

727 VisibilityMask);

728}

729

731 unsigned FlagsToInclude, unsigned FlagsToExclude,

732 bool ShowAllAliases) const {

733 bool ShowHidden = !(FlagsToExclude & HelpHidden);

735 return internalPrintHelp(

736 OS, Usage, Title, {}, ShowHidden, ShowAllAliases,

737 [FlagsToInclude, FlagsToExclude](const Info &CandidateInfo) {

738 if (FlagsToInclude && !(CandidateInfo.Flags & FlagsToInclude))

739 return true;

740 if (CandidateInfo.Flags & FlagsToExclude)

741 return true;

742 return false;

743 },

745}

746

747void OptTable::internalPrintHelp(

749 bool ShowHidden, bool ShowAllAliases,

750 std::function<bool(const Info &)> ExcludeOption,

752 OS << "OVERVIEW: " << Title << "\n\n";

753

754

755

756 std::map<std::string, std::vector> GroupedOptionHelp;

757

759 SubCommands, [&](const auto &C) { return SubCommand == C.Name; });

760 if (!SubCommand.empty()) {

761 assert(ActiveSubCommand != SubCommands.end() &&

762 "Not a valid registered subcommand.");

763 OS << ActiveSubCommand->HelpText << "\n\n";

765 OS << "USAGE: " << ActiveSubCommand->Usage << "\n\n";

766 } else {

767 OS << "USAGE: " << Usage << "\n\n";

768 if (SubCommands.size() > 1) {

769 OS << "SUBCOMMANDS:\n\n";

770 for (const auto &C : SubCommands)

771 OS << C.Name << " - " << C.HelpText << "\n";

772 OS << "\n";

773 }

774 }

775

776 auto DoesOptionBelongToSubcommand = [&](const Info &CandidateInfo) {

777

778

779 ArrayRef SubCommandIDs =

780 CandidateInfo.getSubCommandIDs(SubCommandIDsTable);

781

782

783

784

785 if (SubCommandIDs.empty())

787

788

789

790

792 return false;

793

794

795

796 unsigned ActiveSubCommandID = ActiveSubCommand - &SubCommands[0];

797

798

800 };

801

803

805 continue;

806

807 const Info &CandidateInfo = getInfo(Id);

808 if (!ShowHidden && (CandidateInfo.Flags & opt::HelpHidden))

809 continue;

810

811 if (ExcludeOption(CandidateInfo))

812 continue;

813

814 if (!DoesOptionBelongToSubcommand(CandidateInfo))

815 continue;

816

817

818

820 if (!HelpText && ShowAllAliases) {

824 }

825

826 if (HelpText && (strlen(HelpText) != 0)) {

829 GroupedOptionHelp[HelpGroup].push_back({OptName, HelpText});

830 }

831 }

832

833 for (auto& OptionGroup : GroupedOptionHelp) {

834 if (OptionGroup.first != GroupedOptionHelp.begin()->first)

835 OS << "\n";

837 }

838

840}

841

847 : OptTable(StrTable, PrefixesTable, OptionInfos, IgnoreCase, SubCommands,

848 SubCommandIDsTable) {

849

850 std::set TmpPrefixesUnion;

853 TmpPrefixesUnion.insert(StrTable[PrefixOffset]);

854 PrefixesUnion.append(TmpPrefixesUnion.begin(), TmpPrefixesUnion.end());

856}

for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Defines the llvm::Arg class for parsed arguments.

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

static const char * getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id)

Definition OptTable.cpp:700

static unsigned matchOption(const StringTable &StrTable, ArrayRef< StringTable::Offset > PrefixesTable, const OptTable::Info *I, StringRef Str, bool IgnoreCase)

Definition OptTable.cpp:158

static bool optionMatches(const StringTable &StrTable, ArrayRef< StringTable::Offset > PrefixesTable, const OptTable::Info &In, StringRef Option)

Definition OptTable.cpp:177

static std::string getOptionHelpName(const OptTable &Opts, OptSpecifier Id)

Definition OptTable.cpp:611

static bool isInput(const ArrayRef< StringRef > &Prefixes, StringRef Arg)

Definition OptTable.cpp:148

static void PrintHelpOptionList(raw_ostream &OS, StringRef Title, std::vector< OptionInfo > &OptionHelp)

Definition OptTable.cpp:663

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

bool empty() const

empty - Check if the array is empty.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

std::pair< StringRef, StringRef > split(char Separator) const

Split into two substrings around the first occurrence of a separator character.

constexpr StringRef substr(size_t Start, size_t N=npos) const

Return a reference to the substring from [Start, Start + N).

bool starts_with(StringRef Prefix) const

Check if this string starts with the given Prefix.

constexpr bool empty() const

empty - Check if the string is empty.

LLVM_ABI bool starts_with_insensitive(StringRef Prefix) const

Check if this string starts with the given Prefix, ignoring case.

LLVM_ABI unsigned edit_distance(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const

Determine the edit distance between this string and another string.

char back() const

back - Get the last character in the string.

constexpr size_t size() const

size - Get the string size.

Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.

A table of densely packed, null-terminated strings indexed by offset.

Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...

ArgList - Ordered collection of driver arguments.

A concrete instance of a particular driver option.

LLVM_ABI GenericOptTable(const StringTable &StrTable, ArrayRef< StringTable::Offset > PrefixesTable, ArrayRef< Info > OptionInfos, bool IgnoreCase=false, ArrayRef< SubCommand > SubCommands={}, ArrayRef< unsigned > SubCommandIDsTable={})

Definition OptTable.cpp:842

OptSpecifier - Wrapper class for abstracting references to option IDs.

Provide access to the Option info table.

void buildPrefixChars()

Build (or rebuild) the PrefixChars member.

Definition OptTable.cpp:127

InputArgList parseArgs(int Argc, char *const *Argv, OptSpecifier Unknown, StringSaver &Saver, std::function< void(StringRef)> ErrorFn) const

A convenience helper which handles optional initial options populated from an environment variable,...

Definition OptTable.cpp:584

unsigned getOptionKind(OptSpecifier id) const

Get the kind of the given option.

unsigned FirstSearchableIndex

The index of the first option which can be parsed (i.e., is not a special option like 'input' or 'unk...

const char * getOptionMetaVar(OptSpecifier id) const

Get the meta-variable name to use when describing this options values in the help text.

std::unique_ptr< Arg > ParseOneArg(const ArgList &Args, unsigned &Index, Visibility VisibilityMask=Visibility()) const

Parse a single argument; returning the new argument and updating Index.

Definition OptTable.cpp:418

unsigned findNearest(StringRef Option, std::string &NearestString, Visibility VisibilityMask=Visibility(), unsigned MinimumLength=4, unsigned MaximumDistance=UINT_MAX) const

Find the OptTable option that most closely matches the given string.

Definition OptTable.cpp:237

SmallVector< StringRef > PrefixesUnion

The union of all option prefixes.

const Option getOption(OptSpecifier Opt) const

Get the given Opt's Option instance, lazily creating it if necessary.

Definition OptTable.cpp:140

const char * getOptionHelpText(OptSpecifier id) const

Get the help text to use to describe this option.

OptTable(const StringTable &StrTable, ArrayRef< StringTable::Offset > PrefixesTable, ArrayRef< Info > OptionInfos, bool IgnoreCase=false, ArrayRef< SubCommand > SubCommands={}, ArrayRef< unsigned > SubCommandIDsTable={})

Initialize OptTable using Tablegen'ed OptionInfos.

Definition OptTable.cpp:79

unsigned getOptionGroupID(OptSpecifier id) const

Get the group id for the given option.

std::vector< std::string > suggestValueCompletions(StringRef Option, StringRef Arg) const

Find possible value for given flags.

Definition OptTable.cpp:192

InputArgList ParseArgs(ArrayRef< const char * > Args, unsigned &MissingArgIndex, unsigned &MissingArgCount, Visibility VisibilityMask=Visibility()) const

Parse an list of arguments into an InputArgList.

Definition OptTable.cpp:502

SmallString< 8 > PrefixChars

The union of the first element of all option prefixes.

void printHelp(raw_ostream &OS, const char *Usage, const char *Title, bool ShowHidden=false, bool ShowAllAliases=false, Visibility VisibilityMask=Visibility(), StringRef SubCommand={}) const

Render the help text for an option table.

Definition OptTable.cpp:718

unsigned getNumOptions() const

Return the total number of option classes.

std::vector< std::string > findByPrefix(StringRef Cur, Visibility VisibilityMask, unsigned int DisableFlags) const

Find flags from OptTable which starts with Cur.

Definition OptTable.cpp:212

Option - Abstract representation for a single form of driver argument.

const Option getAlias() const

LLVM_ABI void dump() const

bool hasFlag(unsigned Val) const

Test if this option has the flag Val.

@ RemainingArgsJoinedClass

bool hasVisibilityFlag(unsigned Val) const

Test if this option has the visibility flag Val.

Helper for overload resolution while transitioning from FlagsToInclude/FlagsToExclude APIs to Visibil...

This class implements an extremely fast bulk output stream that can only output to a stream.

raw_ostream & indent(unsigned NumSpaces)

indent - Insert 'NumSpaces' spaces.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

constexpr char Args[]

Key for Kernel::Metadata::mArgs.

@ C

The default llvm calling convention, compatible with C.

LLVM_ABI bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar, SmallVectorImpl< const char * > &NewArgv)

A convenience helper which concatenates the options specified by the environment variable EnvVar and ...

This is an optimization pass for GlobalISel generic memory operations.

int StrCmpOptionName(StringRef A, StringRef B, bool FallbackCaseSensitive=true)

int StrCmpOptionPrefixes(ArrayRef< StringRef > APrefixes, ArrayRef< StringRef > BPrefixes)

class LLVM_GSL_OWNER SmallVector

Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...

ArrayRef(const T &OneElt) -> ArrayRef< T >

auto find_if(R &&Range, UnaryPredicate P)

Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.

Entry for a single option instance in the option data table.

ArrayRef< StringTable::Offset > getPrefixOffsets(ArrayRef< StringTable::Offset > PrefixesTable) const

Represents a subcommand and its options in the option table.