LLVM  5.0.0
OptTable.cpp
Go to the documentation of this file.
1 //===- OptTable.cpp - Option Table Implementation -------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/ADT/STLExtras.h"
11 #include "llvm/ADT/StringRef.h"
12 #include "llvm/ADT/StringSet.h"
13 #include "llvm/Option/Arg.h"
14 #include "llvm/Option/ArgList.h"
15 #include "llvm/Option/Option.h"
17 #include "llvm/Option/OptTable.h"
18 #include "llvm/Support/Compiler.h"
21 #include <algorithm>
22 #include <cassert>
23 #include <cctype>
24 #include <cstring>
25 #include <map>
26 #include <string>
27 #include <utility>
28 #include <vector>
29 
30 using namespace llvm;
31 using namespace llvm::opt;
32 
33 namespace llvm {
34 namespace opt {
35 
36 // Ordering on Info. The ordering is *almost* case-insensitive lexicographic,
37 // with an exceptions. '\0' comes at the end of the alphabet instead of the
38 // beginning (thus options precede any other options which prefix them).
39 static int StrCmpOptionNameIgnoreCase(const char *A, const char *B) {
40  const char *X = A, *Y = B;
41  char a = tolower(*A), b = tolower(*B);
42  while (a == b) {
43  if (a == '\0')
44  return 0;
45 
46  a = tolower(*++X);
47  b = tolower(*++Y);
48  }
49 
50  if (a == '\0') // A is a prefix of B.
51  return 1;
52  if (b == '\0') // B is a prefix of A.
53  return -1;
54 
55  // Otherwise lexicographic.
56  return (a < b) ? -1 : 1;
57 }
58 
59 #ifndef NDEBUG
60 static int StrCmpOptionName(const char *A, const char *B) {
61  if (int N = StrCmpOptionNameIgnoreCase(A, B))
62  return N;
63  return strcmp(A, B);
64 }
65 
66 static inline bool operator<(const OptTable::Info &A, const OptTable::Info &B) {
67  if (&A == &B)
68  return false;
69 
70  if (int N = StrCmpOptionName(A.Name, B.Name))
71  return N < 0;
72 
73  for (const char * const *APre = A.Prefixes,
74  * const *BPre = B.Prefixes;
75  *APre != nullptr && *BPre != nullptr; ++APre, ++BPre){
76  if (int N = StrCmpOptionName(*APre, *BPre))
77  return N < 0;
78  }
79 
80  // Names are the same, check that classes are in order; exactly one
81  // should be joined, and it should succeed the other.
83  "Unexpected classes for options with same name.");
84  return B.Kind == Option::JoinedClass;
85 }
86 #endif
87 
88 // Support lower_bound between info and an option name.
89 static inline bool operator<(const OptTable::Info &I, const char *Name) {
90  return StrCmpOptionNameIgnoreCase(I.Name, Name) < 0;
91 }
92 
93 } // end namespace opt
94 } // end namespace llvm
95 
96 OptSpecifier::OptSpecifier(const Option *Opt) : ID(Opt->getID()) {}
97 
98 OptTable::OptTable(ArrayRef<Info> OptionInfos, bool IgnoreCase)
99  : OptionInfos(OptionInfos), IgnoreCase(IgnoreCase) {
100  // Explicitly zero initialize the error to work around a bug in array
101  // value-initialization on MinGW with gcc 4.3.5.
102 
103  // Find start of normal options.
104  for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
105  unsigned Kind = getInfo(i + 1).Kind;
106  if (Kind == Option::InputClass) {
107  assert(!TheInputOptionID && "Cannot have multiple input options!");
108  TheInputOptionID = getInfo(i + 1).ID;
109  } else if (Kind == Option::UnknownClass) {
110  assert(!TheUnknownOptionID && "Cannot have multiple unknown options!");
111  TheUnknownOptionID = getInfo(i + 1).ID;
112  } else if (Kind != Option::GroupClass) {
113  FirstSearchableIndex = i;
114  break;
115  }
116  }
117  assert(FirstSearchableIndex != 0 && "No searchable options?");
118 
119 #ifndef NDEBUG
120  // Check that everything after the first searchable option is a
121  // regular option class.
122  for (unsigned i = FirstSearchableIndex, e = getNumOptions(); i != e; ++i) {
124  assert((Kind != Option::InputClass && Kind != Option::UnknownClass &&
125  Kind != Option::GroupClass) &&
126  "Special options should be defined first!");
127  }
128 
129  // Check that options are in order.
130  for (unsigned i = FirstSearchableIndex + 1, e = getNumOptions(); i != e; ++i){
131  if (!(getInfo(i) < getInfo(i + 1))) {
132  getOption(i).dump();
133  getOption(i + 1).dump();
134  llvm_unreachable("Options are not in order!");
135  }
136  }
137 #endif
138 
139  // Build prefixes.
140  for (unsigned i = FirstSearchableIndex + 1, e = getNumOptions() + 1;
141  i != e; ++i) {
142  if (const char *const *P = getInfo(i).Prefixes) {
143  for (; *P != nullptr; ++P) {
144  PrefixesUnion.insert(*P);
145  }
146  }
147  }
148 
149  // Build prefix chars.
150  for (StringSet<>::const_iterator I = PrefixesUnion.begin(),
151  E = PrefixesUnion.end(); I != E; ++I) {
152  StringRef Prefix = I->getKey();
153  for (StringRef::const_iterator C = Prefix.begin(), CE = Prefix.end();
154  C != CE; ++C)
155  if (!is_contained(PrefixChars, *C))
156  PrefixChars.push_back(*C);
157  }
158 }
159 
160 OptTable::~OptTable() = default;
161 
163  unsigned id = Opt.getID();
164  if (id == 0)
165  return Option(nullptr, nullptr);
166  assert((unsigned) (id - 1) < getNumOptions() && "Invalid ID.");
167  return Option(&getInfo(id), this);
168 }
169 
170 static bool isInput(const StringSet<> &Prefixes, StringRef Arg) {
171  if (Arg == "-")
172  return true;
173  for (StringSet<>::const_iterator I = Prefixes.begin(),
174  E = Prefixes.end(); I != E; ++I)
175  if (Arg.startswith(I->getKey()))
176  return false;
177  return true;
178 }
179 
180 /// \returns Matched size. 0 means no match.
181 static unsigned matchOption(const OptTable::Info *I, StringRef Str,
182  bool IgnoreCase) {
183  for (const char * const *Pre = I->Prefixes; *Pre != nullptr; ++Pre) {
184  StringRef Prefix(*Pre);
185  if (Str.startswith(Prefix)) {
186  StringRef Rest = Str.substr(Prefix.size());
187  bool Matched = IgnoreCase
188  ? Rest.startswith_lower(I->Name)
189  : Rest.startswith(I->Name);
190  if (Matched)
191  return Prefix.size() + StringRef(I->Name).size();
192  }
193  }
194  return 0;
195 }
196 
197 // Returns true if one of the Prefixes + In.Names matches Option
199  if (In.Values && In.Prefixes)
200  for (size_t I = 0; In.Prefixes[I]; I++)
201  if (Option == std::string(In.Prefixes[I]) + In.Name)
202  return true;
203  return false;
204 }
205 
206 // This function is for flag value completion.
207 // Eg. When "-stdlib=" and "l" was passed to this function, it will return
208 // appropiriate values for stdlib, which starts with l.
209 std::vector<std::string>
211  // Search all options and return possible values.
212  for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) {
213  if (!optionMatches(In, Option))
214  continue;
215 
216  SmallVector<StringRef, 8> Candidates;
217  StringRef(In.Values).split(Candidates, ",", -1, false);
218 
219  std::vector<std::string> Result;
220  for (StringRef Val : Candidates)
221  if (Val.startswith(Arg))
222  Result.push_back(Val);
223  return Result;
224  }
225  return {};
226 }
227 
228 std::vector<std::string>
229 OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const {
230  std::vector<std::string> Ret;
231  for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) {
232  if (!In.Prefixes || (!In.HelpText && !In.GroupID))
233  continue;
234  if (In.Flags & DisableFlags)
235  continue;
236 
237  for (int I = 0; In.Prefixes[I]; I++) {
238  std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t";
239  if (In.HelpText)
240  S += In.HelpText;
241  if (StringRef(S).startswith(Cur))
242  Ret.push_back(S);
243  }
244  }
245  return Ret;
246 }
247 
248 Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index,
249  unsigned FlagsToInclude,
250  unsigned FlagsToExclude) const {
251  unsigned Prev = Index;
252  const char *Str = Args.getArgString(Index);
253 
254  // Anything that doesn't start with PrefixesUnion is an input, as is '-'
255  // itself.
256  if (isInput(PrefixesUnion, Str))
257  return new Arg(getOption(TheInputOptionID), Str, Index++, Str);
258 
259  const Info *Start = OptionInfos.begin() + FirstSearchableIndex;
260  const Info *End = OptionInfos.end();
261  StringRef Name = StringRef(Str).ltrim(PrefixChars);
262 
263  // Search for the first next option which could be a prefix.
264  Start = std::lower_bound(Start, End, Name.data());
265 
266  // Options are stored in sorted order, with '\0' at the end of the
267  // alphabet. Since the only options which can accept a string must
268  // prefix it, we iteratively search for the next option which could
269  // be a prefix.
270  //
271  // FIXME: This is searching much more than necessary, but I am
272  // blanking on the simplest way to make it fast. We can solve this
273  // problem when we move to TableGen.
274  for (; Start != End; ++Start) {
275  unsigned ArgSize = 0;
276  // Scan for first option which is a proper prefix.
277  for (; Start != End; ++Start)
278  if ((ArgSize = matchOption(Start, Str, IgnoreCase)))
279  break;
280  if (Start == End)
281  break;
282 
283  Option Opt(Start, this);
284 
285  if (FlagsToInclude && !Opt.hasFlag(FlagsToInclude))
286  continue;
287  if (Opt.hasFlag(FlagsToExclude))
288  continue;
289 
290  // See if this option matches.
291  if (Arg *A = Opt.accept(Args, Index, ArgSize))
292  return A;
293 
294  // Otherwise, see if this argument was missing values.
295  if (Prev != Index)
296  return nullptr;
297  }
298 
299  // If we failed to find an option and this arg started with /, then it's
300  // probably an input path.
301  if (Str[0] == '/')
302  return new Arg(getOption(TheInputOptionID), Str, Index++, Str);
303 
304  return new Arg(getOption(TheUnknownOptionID), Str, Index++, Str);
305 }
306 
308  unsigned &MissingArgIndex,
309  unsigned &MissingArgCount,
310  unsigned FlagsToInclude,
311  unsigned FlagsToExclude) const {
312  InputArgList Args(ArgArr.begin(), ArgArr.end());
313 
314  // FIXME: Handle '@' args (or at least error on them).
315 
316  MissingArgIndex = MissingArgCount = 0;
317  unsigned Index = 0, End = ArgArr.size();
318  while (Index < End) {
319  // Ingore nullptrs, they are response file's EOL markers
320  if (Args.getArgString(Index) == nullptr) {
321  ++Index;
322  continue;
323  }
324  // Ignore empty arguments (other things may still take them as arguments).
325  StringRef Str = Args.getArgString(Index);
326  if (Str == "") {
327  ++Index;
328  continue;
329  }
330 
331  unsigned Prev = Index;
332  Arg *A = ParseOneArg(Args, Index, FlagsToInclude, FlagsToExclude);
333  assert(Index > Prev && "Parser failed to consume argument.");
334 
335  // Check for missing argument error.
336  if (!A) {
337  assert(Index >= End && "Unexpected parser error.");
338  assert(Index - Prev - 1 && "No missing arguments!");
339  MissingArgIndex = Prev;
340  MissingArgCount = Index - Prev - 1;
341  break;
342  }
343 
344  Args.append(A);
345  }
346 
347  return Args;
348 }
349 
350 static std::string getOptionHelpName(const OptTable &Opts, OptSpecifier Id) {
351  const Option O = Opts.getOption(Id);
352  std::string Name = O.getPrefixedName();
353 
354  // Add metavar, if used.
355  switch (O.getKind()) {
357  llvm_unreachable("Invalid option with help text.");
358 
360  if (const char *MetaVarName = Opts.getOptionMetaVar(Id)) {
361  // For MultiArgs, metavar is full list of all argument names.
362  Name += ' ';
363  Name += MetaVarName;
364  }
365  else {
366  // For MultiArgs<N>, if metavar not supplied, print <value> N times.
367  for (unsigned i=0, e=O.getNumArgs(); i< e; ++i) {
368  Name += " <value>";
369  }
370  }
371  break;
372 
373  case Option::FlagClass:
374  break;
375 
376  case Option::ValuesClass:
377  break;
378 
381  Name += ' ';
385  if (const char *MetaVarName = Opts.getOptionMetaVar(Id))
386  Name += MetaVarName;
387  else
388  Name += "<value>";
389  break;
390  }
391 
392  return Name;
393 }
394 
395 namespace {
396 struct OptionInfo {
397  std::string Name;
398  StringRef HelpText;
399 };
400 } // namespace
401 
403  std::vector<OptionInfo> &OptionHelp) {
404  OS << Title << ":\n";
405 
406  // Find the maximum option length.
407  unsigned OptionFieldWidth = 0;
408  for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {
409  // Limit the amount of padding we are willing to give up for alignment.
410  unsigned Length = OptionHelp[i].Name.size();
411  if (Length <= 23)
412  OptionFieldWidth = std::max(OptionFieldWidth, Length);
413  }
414 
415  const unsigned InitialPad = 2;
416  for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {
417  const std::string &Option = OptionHelp[i].Name;
418  int Pad = OptionFieldWidth - int(Option.size());
419  OS.indent(InitialPad) << Option;
420 
421  // Break on long option names.
422  if (Pad < 0) {
423  OS << "\n";
424  Pad = OptionFieldWidth + InitialPad;
425  }
426  OS.indent(Pad + 1) << OptionHelp[i].HelpText << '\n';
427  }
428 }
429 
430 static const char *getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id) {
431  unsigned GroupID = Opts.getOptionGroupID(Id);
432 
433  // If not in a group, return the default help group.
434  if (!GroupID)
435  return "OPTIONS";
436 
437  // Abuse the help text of the option groups to store the "help group"
438  // name.
439  //
440  // FIXME: Split out option groups.
441  if (const char *GroupHelp = Opts.getOptionHelpText(GroupID))
442  return GroupHelp;
443 
444  // Otherwise keep looking.
445  return getOptionHelpGroup(Opts, GroupID);
446 }
447 
448 void OptTable::PrintHelp(raw_ostream &OS, const char *Name, const char *Title,
449  bool ShowHidden) const {
450  PrintHelp(OS, Name, Title, /*Include*/ 0, /*Exclude*/
451  (ShowHidden ? 0 : HelpHidden));
452 }
453 
454 
455 void OptTable::PrintHelp(raw_ostream &OS, const char *Name, const char *Title,
456  unsigned FlagsToInclude,
457  unsigned FlagsToExclude) const {
458  OS << "OVERVIEW: " << Title << "\n";
459  OS << '\n';
460  OS << "USAGE: " << Name << " [options] <inputs>\n";
461  OS << '\n';
462 
463  // Render help text into a map of group-name to a list of (option, help)
464  // pairs.
465  using helpmap_ty = std::map<std::string, std::vector<OptionInfo>>;
466  helpmap_ty GroupedOptionHelp;
467 
468  for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
469  unsigned Id = i + 1;
470 
471  // FIXME: Split out option groups.
473  continue;
474 
475  unsigned Flags = getInfo(Id).Flags;
476  if (FlagsToInclude && !(Flags & FlagsToInclude))
477  continue;
478  if (Flags & FlagsToExclude)
479  continue;
480 
481  if (const char *Text = getOptionHelpText(Id)) {
482  const char *HelpGroup = getOptionHelpGroup(*this, Id);
483  const std::string &OptName = getOptionHelpName(*this, Id);
484  GroupedOptionHelp[HelpGroup].push_back({OptName, Text});
485  }
486  }
487 
488  for (helpmap_ty::iterator it = GroupedOptionHelp .begin(),
489  ie = GroupedOptionHelp.end(); it != ie; ++it) {
490  if (it != GroupedOptionHelp .begin())
491  OS << "\n";
492  PrintHelpOptionList(OS, it->first, it->second);
493  }
494 
495  OS.flush();
496 }
void dump() const
Definition: Option.cpp:90
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:234
unsigned short Flags
Definition: OptTable.h:52
static bool operator<(const OptTable::Info &A, const OptTable::Info &B)
Definition: OptTable.cpp:66
iterator end() const
Definition: ArrayRef.h:138
bool hasFlag(unsigned Val) const
Test if this option has the flag Val.
Definition: Option.h:171
static unsigned matchOption(const OptTable::Info *I, StringRef Str, bool IgnoreCase)
Definition: OptTable.cpp:181
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
InputArgList ParseArgs(ArrayRef< const char * > Args, unsigned &MissingArgIndex, unsigned &MissingArgCount, unsigned FlagsToInclude=0, unsigned FlagsToExclude=0) const
Parse an list of arguments into an InputArgList.
Definition: OptTable.cpp:307
OptionClass getKind() const
Definition: Option.h:93
const char * getOptionHelpText(OptSpecifier id) const
Get the help text to use to describe this option.
Definition: OptTable.h:114
static bool startswith(StringRef Magic, const char(&S)[N])
Definition: Magic.cpp:29
static int getID(struct InternalInstruction *insn, const void *miiArg)
static bool optionMatches(const OptTable::Info &In, StringRef Option)
Definition: OptTable.cpp:198
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:267
unsigned char Kind
Definition: OptTable.h:50
unsigned getNumArgs() const
Definition: Option.h:139
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
OptTable(ArrayRef< Info > OptionInfos, bool IgnoreCase=false)
Definition: OptTable.cpp:98
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Definition: StringRef.h:138
static const char * getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id)
Definition: OptTable.cpp:430
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:149
const char * Name
iterator begin() const
Definition: StringRef.h:106
#define P(N)
friend const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:243
Option - Abstract representation for a single form of driver argument.
Definition: Option.h:52
A concrete instance of a particular driver option.
Definition: Arg.h:35
Provide access to the Option info table.
Definition: OptTable.h:39
std::string getPrefixedName() const
Get the name of this option with the default prefix.
Definition: Option.h:133
const char *const * Prefixes
A null terminated array of prefix strings to apply to name while matching.
Definition: OptTable.h:45
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
#define A
Definition: LargeTest.cpp:12
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition: StringRef.h:598
amode opt
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static const unsigned End
iterator begin() const
Definition: ArrayRef.h:137
static int StrCmpOptionName(const char *A, const char *B)
Definition: OptTable.cpp:60
unsigned getID() const
Definition: OptSpecifier.h:30
const char * Values
Definition: OptTable.h:56
std::pair< typename base::iterator, bool > insert(StringRef Key)
Definition: StringSet.h:38
#define E
Definition: LargeTest.cpp:27
#define B
Definition: LargeTest.cpp:24
virtual const char * getArgString(unsigned Index) const =0
getArgString - Return the input argument string at Index.
static void PrintHelpOptionList(raw_ostream &OS, StringRef Title, std::vector< OptionInfo > &OptionHelp)
Definition: OptTable.cpp:402
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
static int StrCmpOptionNameIgnoreCase(const char *A, const char *B)
Definition: OptTable.cpp:39
const size_t N
std::vector< std::string > findByPrefix(StringRef Cur, unsigned short DisableFlags) const
Find flags from OptTable which starts with Cur.
Definition: OptTable.cpp:229
void PrintHelp(raw_ostream &OS, const char *Name, const char *Title, unsigned FlagsToInclude, unsigned FlagsToExclude) const
Render the help text for an option table.
Definition: OptTable.cpp:455
unsigned getNumOptions() const
Return the total number of option classes.
Definition: OptTable.h:90
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Definition: StringRef.h:727
Defines the llvm::Arg class for parsed arguments.
unsigned getOptionKind(OptSpecifier id) const
Get the kind of the given option.
Definition: OptTable.h:104
llvm_unreachable("Unknown RegBank!")
static std::vector< std::string > Flags
Definition: FlagsTest.cpp:8
std::vector< std::string > suggestValueCompletions(StringRef Option, StringRef Arg) const
Find possible value for given flags.
Definition: OptTable.cpp:210
OptSpecifier - Wrapper class for abstracting references to option IDs.
Definition: OptSpecifier.h:19
iterator begin()
Definition: StringMap.h:315
const Option getOption(OptSpecifier Opt) const
Get the given Opt's Option instance, lazily creating it if necessary.
Definition: OptTable.cpp:162
#define C
Definition: LargeTest.cpp:25
Entry for a single option instance in the option data table.
Definition: OptTable.h:42
#define I(x, y, z)
Definition: MD5.cpp:58
LLVM_NODISCARD StringRef ltrim(char Char) const
Return string with consecutive Char characters starting from the the left removed.
Definition: StringRef.h:808
Arg * ParseOneArg(const ArgList &Args, unsigned &Index, unsigned FlagsToInclude=0, unsigned FlagsToExclude=0) const
Parse a single argument; returning the new argument and updating Index.
Definition: OptTable.cpp:248
static std::string getOptionHelpName(const OptTable &Opts, OptSpecifier Id)
Definition: OptTable.cpp:350
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isInput(const StringSet<> &Prefixes, StringRef Arg)
Definition: OptTable.cpp:170
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:235
StringSet - A wrapper for StringMap that provides set-like functionality.
Definition: StringSet.h:28
iterator end() const
Definition: StringRef.h:108
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:128
Arg * accept(const ArgList &Args, unsigned &Index, unsigned ArgSize) const
accept - Potentially accept the current argument, returning a new Arg instance, or 0 if the option do...
Definition: Option.cpp:109
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
ArgList - Ordered collection of driver arguments.
Definition: ArgList.h:120
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
unsigned getOptionGroupID(OptSpecifier id) const
Get the group id for the given option.
Definition: OptTable.h:109
LLVM_NODISCARD bool startswith_lower(StringRef Prefix) const
Check if this string starts with the given Prefix, ignoring case.
Definition: StringRef.cpp:62
iterator end()
Definition: StringMap.h:318
const char * getOptionMetaVar(OptSpecifier id) const
Get the meta-variable name to use when describing this options values in the help text...
Definition: OptTable.h:120
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:872