LLVM  14.0.0git
CommandLine.h
Go to the documentation of this file.
1 //===- llvm/Support/CommandLine.h - Command line handler --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class implements a command line argument processor that is useful when
10 // creating a tool. It provides a simple, minimalistic interface that is easily
11 // extensible and supports nonlocal (library) command line options.
12 //
13 // Note that rather than trying to figure out what this code does, you should
14 // read the library documentation located in docs/CommandLine.html or looks at
15 // the many example usages in tools/*/*.cpp
16 //
17 //===----------------------------------------------------------------------===//
18 
19 #ifndef LLVM_SUPPORT_COMMANDLINE_H
20 #define LLVM_SUPPORT_COMMANDLINE_H
21 
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/None.h"
24 #include "llvm/ADT/Optional.h"
25 #include "llvm/ADT/STLExtras.h"
26 #include "llvm/ADT/SmallPtrSet.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringMap.h"
29 #include "llvm/ADT/StringRef.h"
30 #include "llvm/ADT/Twine.h"
35 #include <cassert>
36 #include <climits>
37 #include <cstddef>
38 #include <functional>
39 #include <initializer_list>
40 #include <string>
41 #include <type_traits>
42 #include <vector>
43 
44 namespace llvm {
45 
46 namespace vfs {
47 class FileSystem;
48 }
49 
50 class StringSaver;
51 
52 /// cl Namespace - This namespace contains all of the command line option
53 /// processing machinery. It is intentionally a short name to make qualified
54 /// usage concise.
55 namespace cl {
56 
57 //===----------------------------------------------------------------------===//
58 // ParseCommandLineOptions - Command line option processing entry point.
59 //
60 // Returns true on success. Otherwise, this will print the error message to
61 // stderr and exit if \p Errs is not set (nullptr by default), or print the
62 // error message to \p Errs and return false if \p Errs is provided.
63 //
64 // If EnvVar is not nullptr, command-line options are also parsed from the
65 // environment variable named by EnvVar. Precedence is given to occurrences
66 // from argv. This precedence is currently implemented by parsing argv after
67 // the environment variable, so it is only implemented correctly for options
68 // that give precedence to later occurrences. If your program supports options
69 // that give precedence to earlier occurrences, you will need to extend this
70 // function to support it correctly.
71 bool ParseCommandLineOptions(int argc, const char *const *argv,
72  StringRef Overview = "",
73  raw_ostream *Errs = nullptr,
74  const char *EnvVar = nullptr,
75  bool LongOptionsUseDoubleDash = false);
76 
77 // Function pointer type for printing version information.
79 
80 ///===---------------------------------------------------------------------===//
81 /// SetVersionPrinter - Override the default (LLVM specific) version printer
82 /// used to print out the version when --version is given
83 /// on the command line. This allows other systems using the
84 /// CommandLine utilities to print their own version string.
86 
87 ///===---------------------------------------------------------------------===//
88 /// AddExtraVersionPrinter - Add an extra printer to use in addition to the
89 /// default one. This can be called multiple times,
90 /// and each time it adds a new function to the list
91 /// which will be called after the basic LLVM version
92 /// printing is complete. Each can then add additional
93 /// information specific to the tool.
95 
96 // PrintOptionValues - Print option values.
97 // With -print-options print the difference between option values and defaults.
98 // With -print-all-options print all option values.
99 // (Currently not perfect, but best-effort.)
100 void PrintOptionValues();
101 
102 // Forward declaration - AddLiteralOption needs to be up here to make gcc happy.
103 class Option;
104 
105 /// Adds a new option for parsing and provides the option it refers to.
106 ///
107 /// \param O pointer to the option
108 /// \param Name the string name for the option to handle during parsing
109 ///
110 /// Literal options are used by some parsers to register special option values.
111 /// This is how the PassNameParser registers pass names for opt.
113 
114 //===----------------------------------------------------------------------===//
115 // Flags permitted to be passed to command line arguments
116 //
117 
118 enum NumOccurrencesFlag { // Flags for the number of occurrences allowed
119  Optional = 0x00, // Zero or One occurrence
120  ZeroOrMore = 0x01, // Zero or more occurrences allowed
121  Required = 0x02, // One occurrence required
122  OneOrMore = 0x03, // One or more occurrences required
123 
124  // ConsumeAfter - Indicates that this option is fed anything that follows the
125  // last positional argument required by the application (it is an error if
126  // there are zero positional arguments, and a ConsumeAfter option is used).
127  // Thus, for example, all arguments to LLI are processed until a filename is
128  // found. Once a filename is found, all of the succeeding arguments are
129  // passed, unprocessed, to the ConsumeAfter option.
130  //
132 };
133 
134 enum ValueExpected { // Is a value required for the option?
135  // zero reserved for the unspecified value
136  ValueOptional = 0x01, // The value can appear... or not
137  ValueRequired = 0x02, // The value is required to appear!
138  ValueDisallowed = 0x03 // A value may not be specified (for flags)
139 };
140 
141 enum OptionHidden { // Control whether -help shows this option
142  NotHidden = 0x00, // Option included in -help & -help-hidden
143  Hidden = 0x01, // -help doesn't, but -help-hidden does
144  ReallyHidden = 0x02 // Neither -help nor -help-hidden show this arg
145 };
146 
147 // Formatting flags - This controls special features that the option might have
148 // that cause it to be parsed differently...
149 //
150 // Prefix - This option allows arguments that are otherwise unrecognized to be
151 // matched by options that are a prefix of the actual value. This is useful for
152 // cases like a linker, where options are typically of the form '-lfoo' or
153 // '-L../../include' where -l or -L are the actual flags. When prefix is
154 // enabled, and used, the value for the flag comes from the suffix of the
155 // argument.
156 //
157 // AlwaysPrefix - Only allow the behavior enabled by the Prefix flag and reject
158 // the Option=Value form.
159 //
160 
162  NormalFormatting = 0x00, // Nothing special
163  Positional = 0x01, // Is a positional argument, no '-' required
164  Prefix = 0x02, // Can this option directly prefix its value?
165  AlwaysPrefix = 0x03 // Can this option only directly prefix its value?
166 };
167 
168 enum MiscFlags { // Miscellaneous flags to adjust argument
169  CommaSeparated = 0x01, // Should this cl::list split between commas?
170  PositionalEatsArgs = 0x02, // Should this positional cl::list eat -args?
171  Sink = 0x04, // Should this cl::list eat all unknown options?
172 
173  // Grouping - Can this option group with other options?
174  // If this is enabled, multiple letter options are allowed to bunch together
175  // with only a single hyphen for the whole group. This allows emulation
176  // of the behavior that ls uses for example: ls -la === ls -l -a
177  Grouping = 0x08,
178 
179  // Default option
181 };
182 
183 //===----------------------------------------------------------------------===//
184 // Option Category class
185 //
187 private:
188  StringRef const Name;
189  StringRef const Description;
190 
191  void registerCategory();
192 
193 public:
195  StringRef const Description = "")
196  : Name(Name), Description(Description) {
197  registerCategory();
198  }
199 
200  StringRef getName() const { return Name; }
201  StringRef getDescription() const { return Description; }
202 };
203 
204 // The general Option Category (used as default category).
205 OptionCategory &getGeneralCategory();
206 
207 //===----------------------------------------------------------------------===//
208 // SubCommand class
209 //
210 class SubCommand {
211 private:
212  StringRef Name;
213  StringRef Description;
214 
215 protected:
216  void registerSubCommand();
217  void unregisterSubCommand();
218 
219 public:
220  SubCommand(StringRef Name, StringRef Description = "")
221  : Name(Name), Description(Description) {
223  }
224  SubCommand() = default;
225 
226  void reset();
227 
228  explicit operator bool() const;
229 
230  StringRef getName() const { return Name; }
231  StringRef getDescription() const { return Description; }
232 
236 
237  Option *ConsumeAfterOpt = nullptr; // The ConsumeAfter option if it exists.
238 };
239 
240 // A special subcommand representing no subcommand
242 
243 // A special subcommand that can be used to put an option into all subcommands.
245 
246 //===----------------------------------------------------------------------===//
247 // Option Base class
248 //
249 class Option {
250  friend class alias;
251 
252  // handleOccurrences - Overriden by subclasses to handle the value passed into
253  // an argument. Should return true if there was an error processing the
254  // argument and the program should exit.
255  //
256  virtual bool handleOccurrence(unsigned pos, StringRef ArgName,
257  StringRef Arg) = 0;
258 
259  virtual enum ValueExpected getValueExpectedFlagDefault() const {
260  return ValueOptional;
261  }
262 
263  // Out of line virtual function to provide home for the class.
264  virtual void anchor();
265 
266  uint16_t NumOccurrences; // The number of times specified
267  // Occurrences, HiddenFlag, and Formatting are all enum types but to avoid
268  // problems with signed enums in bitfields.
269  uint16_t Occurrences : 3; // enum NumOccurrencesFlag
270  // not using the enum type for 'Value' because zero is an implementation
271  // detail representing the non-value
272  uint16_t Value : 2;
273  uint16_t HiddenFlag : 2; // enum OptionHidden
274  uint16_t Formatting : 2; // enum FormattingFlags
275  uint16_t Misc : 5;
276  uint16_t FullyInitialized : 1; // Has addArgument been called?
277  uint16_t Position; // Position of last occurrence of the option
278  uint16_t AdditionalVals; // Greater than 0 for multi-valued option.
279 
280 public:
281  StringRef ArgStr; // The argument string itself (ex: "help", "o")
282  StringRef HelpStr; // The descriptive text message for -help
283  StringRef ValueStr; // String describing what the value of this option is
285  Categories; // The Categories this option belongs to
286  SmallPtrSet<SubCommand *, 1> Subs; // The subcommands this option belongs to.
287 
289  return (enum NumOccurrencesFlag)Occurrences;
290  }
291 
292  inline enum ValueExpected getValueExpectedFlag() const {
293  return Value ? ((enum ValueExpected)Value) : getValueExpectedFlagDefault();
294  }
295 
296  inline enum OptionHidden getOptionHiddenFlag() const {
297  return (enum OptionHidden)HiddenFlag;
298  }
299 
300  inline enum FormattingFlags getFormattingFlag() const {
301  return (enum FormattingFlags)Formatting;
302  }
303 
304  inline unsigned getMiscFlags() const { return Misc; }
305  inline unsigned getPosition() const { return Position; }
306  inline unsigned getNumAdditionalVals() const { return AdditionalVals; }
307 
308  // hasArgStr - Return true if the argstr != ""
309  bool hasArgStr() const { return !ArgStr.empty(); }
310  bool isPositional() const { return getFormattingFlag() == cl::Positional; }
311  bool isSink() const { return getMiscFlags() & cl::Sink; }
312  bool isDefaultOption() const { return getMiscFlags() & cl::DefaultOption; }
313 
314  bool isConsumeAfter() const {
316  }
317 
318  bool isInAllSubCommands() const {
319  return any_of(Subs, [](const SubCommand *SC) {
320  return SC == &*AllSubCommands;
321  });
322  }
323 
324  //-------------------------------------------------------------------------===
325  // Accessor functions set by OptionModifiers
326  //
327  void setArgStr(StringRef S);
330  void setNumOccurrencesFlag(enum NumOccurrencesFlag Val) { Occurrences = Val; }
331  void setValueExpectedFlag(enum ValueExpected Val) { Value = Val; }
332  void setHiddenFlag(enum OptionHidden Val) { HiddenFlag = Val; }
333  void setFormattingFlag(enum FormattingFlags V) { Formatting = V; }
334  void setMiscFlag(enum MiscFlags M) { Misc |= M; }
335  void setPosition(unsigned pos) { Position = pos; }
337  void addSubCommand(SubCommand &S) { Subs.insert(&S); }
338 
339 protected:
340  explicit Option(enum NumOccurrencesFlag OccurrencesFlag,
341  enum OptionHidden Hidden)
342  : NumOccurrences(0), Occurrences(OccurrencesFlag), Value(0),
343  HiddenFlag(Hidden), Formatting(NormalFormatting), Misc(0),
344  FullyInitialized(false), Position(0), AdditionalVals(0) {
345  Categories.push_back(&getGeneralCategory());
346  }
347 
348  inline void setNumAdditionalVals(unsigned n) { AdditionalVals = n; }
349 
350 public:
351  virtual ~Option() = default;
352 
353  // addArgument - Register this argument with the commandline system.
354  //
355  void addArgument();
356 
357  /// Unregisters this option from the CommandLine system.
358  ///
359  /// This option must have been the last option registered.
360  /// For testing purposes only.
361  void removeArgument();
362 
363  // Return the width of the option tag for printing...
364  virtual size_t getOptionWidth() const = 0;
365 
366  // printOptionInfo - Print out information about this option. The
367  // to-be-maintained width is specified.
368  //
369  virtual void printOptionInfo(size_t GlobalWidth) const = 0;
370 
371  virtual void printOptionValue(size_t GlobalWidth, bool Force) const = 0;
372 
373  virtual void setDefault() = 0;
374 
375  // Prints the help string for an option.
376  //
377  // This maintains the Indent for multi-line descriptions.
378  // FirstLineIndentedBy is the count of chars of the first line
379  // i.e. the one containing the --<option name>.
380  static void printHelpStr(StringRef HelpStr, size_t Indent,
381  size_t FirstLineIndentedBy);
382 
383  // Prints the help string for an enum value.
384  //
385  // This maintains the Indent for multi-line descriptions.
386  // FirstLineIndentedBy is the count of chars of the first line
387  // i.e. the one containing the =<value>.
388  static void printEnumValHelpStr(StringRef HelpStr, size_t Indent,
389  size_t FirstLineIndentedBy);
390 
392 
393  // addOccurrence - Wrapper around handleOccurrence that enforces Flags.
394  //
395  virtual bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value,
396  bool MultiArg = false);
397 
398  // Prints option name followed by message. Always returns true.
399  bool error(const Twine &Message, StringRef ArgName = StringRef(), raw_ostream &Errs = llvm::errs());
400  bool error(const Twine &Message, raw_ostream &Errs) {
401  return error(Message, StringRef(), Errs);
402  }
403 
404  inline int getNumOccurrences() const { return NumOccurrences; }
405  void reset();
406 };
407 
408 //===----------------------------------------------------------------------===//
409 // Command line option modifiers that can be used to modify the behavior of
410 // command line option parsers...
411 //
412 
413 // desc - Modifier to set the description shown in the -help output...
414 struct desc {
416 
417  desc(StringRef Str) : Desc(Str) {}
418 
419  void apply(Option &O) const { O.setDescription(Desc); }
420 };
421 
422 // value_desc - Modifier to set the value description shown in the -help
423 // output...
424 struct value_desc {
426 
427  value_desc(StringRef Str) : Desc(Str) {}
428 
429  void apply(Option &O) const { O.setValueStr(Desc); }
430 };
431 
432 // init - Specify a default (initial) value for the command line argument, if
433 // the default constructor for the argument type does not give you what you
434 // want. This is only valid on "opt" arguments, not on "list" arguments.
435 //
436 template <class Ty> struct initializer {
437  const Ty &Init;
438  initializer(const Ty &Val) : Init(Val) {}
439 
440  template <class Opt> void apply(Opt &O) const { O.setInitialValue(Init); }
441 };
442 
443 template <class Ty> initializer<Ty> init(const Ty &Val) {
444  return initializer<Ty>(Val);
445 }
446 
447 // location - Allow the user to specify which external variable they want to
448 // store the results of the command line argument processing into, if they don't
449 // want to store it in the option itself.
450 //
451 template <class Ty> struct LocationClass {
452  Ty &Loc;
453 
454  LocationClass(Ty &L) : Loc(L) {}
455 
456  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
457 };
458 
459 template <class Ty> LocationClass<Ty> location(Ty &L) {
460  return LocationClass<Ty>(L);
461 }
462 
463 // cat - Specifiy the Option category for the command line argument to belong
464 // to.
465 struct cat {
467 
469 
470  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
471 };
472 
473 // sub - Specify the subcommand that this option belongs to.
474 struct sub {
476 
477  sub(SubCommand &S) : Sub(S) {}
478 
479  template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); }
480 };
481 
482 // Specify a callback function to be called when an option is seen.
483 // Can be used to set other options automatically.
484 template <typename R, typename Ty> struct cb {
486 
487  cb(std::function<R(Ty)> CB) : CB(CB) {}
488 
489  template <typename Opt> void apply(Opt &O) const { O.setCallback(CB); }
490 };
491 
492 namespace detail {
493 template <typename F>
494 struct callback_traits : public callback_traits<decltype(&F::operator())> {};
495 
496 template <typename R, typename C, typename... Args>
497 struct callback_traits<R (C::*)(Args...) const> {
498  using result_type = R;
499  using arg_type = std::tuple_element_t<0, std::tuple<Args...>>;
500  static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter");
501  static_assert(std::is_same<result_type, void>::value,
502  "callback return type must be void");
503  static_assert(std::is_lvalue_reference<arg_type>::value &&
504  std::is_const<std::remove_reference_t<arg_type>>::value,
505  "callback arg_type must be a const lvalue reference");
506 };
507 } // namespace detail
508 
509 template <typename F>
512 callback(F CB) {
513  using result_type = typename detail::callback_traits<F>::result_type;
514  using arg_type = typename detail::callback_traits<F>::arg_type;
515  return cb<result_type, arg_type>(CB);
516 }
517 
518 //===----------------------------------------------------------------------===//
519 // OptionValue class
520 
521 // Support value comparison outside the template.
523  virtual bool compare(const GenericOptionValue &V) const = 0;
524 
525 protected:
526  GenericOptionValue() = default;
527  GenericOptionValue(const GenericOptionValue&) = default;
528  GenericOptionValue &operator=(const GenericOptionValue &) = default;
529  ~GenericOptionValue() = default;
530 
531 private:
532  virtual void anchor();
533 };
534 
535 template <class DataType> struct OptionValue;
536 
537 // The default value safely does nothing. Option value printing is only
538 // best-effort.
539 template <class DataType, bool isClass>
541  // Temporary storage for argument passing.
543 
544  bool hasValue() const { return false; }
545 
546  const DataType &getValue() const { llvm_unreachable("no default value"); }
547 
548  // Some options may take their value from a different data type.
549  template <class DT> void setValue(const DT & /*V*/) {}
550 
551  bool compare(const DataType & /*V*/) const { return false; }
552 
553  bool compare(const GenericOptionValue & /*V*/) const override {
554  return false;
555  }
556 
557 protected:
558  ~OptionValueBase() = default;
559 };
560 
561 // Simple copy of the option value.
562 template <class DataType> class OptionValueCopy : public GenericOptionValue {
563  DataType Value;
564  bool Valid = false;
565 
566 protected:
567  OptionValueCopy(const OptionValueCopy&) = default;
568  OptionValueCopy &operator=(const OptionValueCopy &) = default;
569  ~OptionValueCopy() = default;
570 
571 public:
572  OptionValueCopy() = default;
573 
574  bool hasValue() const { return Valid; }
575 
576  const DataType &getValue() const {
577  assert(Valid && "invalid option value");
578  return Value;
579  }
580 
581  void setValue(const DataType &V) {
582  Valid = true;
583  Value = V;
584  }
585 
586  bool compare(const DataType &V) const { return Valid && (Value != V); }
587 
588  bool compare(const GenericOptionValue &V) const override {
590  static_cast<const OptionValueCopy<DataType> &>(V);
591  if (!VC.hasValue())
592  return false;
593  return compare(VC.getValue());
594  }
595 };
596 
597 // Non-class option values.
598 template <class DataType>
599 struct OptionValueBase<DataType, false> : OptionValueCopy<DataType> {
600  using WrapperType = DataType;
601 
602 protected:
603  OptionValueBase() = default;
604  OptionValueBase(const OptionValueBase&) = default;
605  OptionValueBase &operator=(const OptionValueBase &) = default;
606  ~OptionValueBase() = default;
607 };
608 
609 // Top-level option class.
610 template <class DataType>
611 struct OptionValue final
612  : OptionValueBase<DataType, std::is_class<DataType>::value> {
613  OptionValue() = default;
614 
615  OptionValue(const DataType &V) { this->setValue(V); }
616 
617  // Some options may take their value from a different data type.
618  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
619  this->setValue(V);
620  return *this;
621  }
622 };
623 
624 // Other safe-to-copy-by-value common option types.
626 template <>
628  : OptionValueCopy<cl::boolOrDefault> {
630 
631  OptionValue() = default;
632 
633  OptionValue(const cl::boolOrDefault &V) { this->setValue(V); }
634 
636  setValue(V);
637  return *this;
638  }
639 
640 private:
641  void anchor() override;
642 };
643 
644 template <>
645 struct OptionValue<std::string> final : OptionValueCopy<std::string> {
647 
648  OptionValue() = default;
649 
650  OptionValue(const std::string &V) { this->setValue(V); }
651 
652  OptionValue<std::string> &operator=(const std::string &V) {
653  setValue(V);
654  return *this;
655  }
656 
657 private:
658  void anchor() override;
659 };
660 
661 //===----------------------------------------------------------------------===//
662 // Enum valued command line option
663 //
664 
665 // This represents a single enum value, using "int" as the underlying type.
668  int Value;
670 };
671 
672 #define clEnumVal(ENUMVAL, DESC) \
673  llvm::cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
674 #define clEnumValN(ENUMVAL, FLAGNAME, DESC) \
675  llvm::cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
676 
677 // values - For custom data types, allow specifying a group of values together
678 // as the values that go into the mapping that the option handler uses.
679 //
680 class ValuesClass {
681  // Use a vector instead of a map, because the lists should be short,
682  // the overhead is less, and most importantly, it keeps them in the order
683  // inserted so we can print our option out nicely.
685 
686 public:
687  ValuesClass(std::initializer_list<OptionEnumValue> Options)
688  : Values(Options) {}
689 
690  template <class Opt> void apply(Opt &O) const {
691  for (const auto &Value : Values)
692  O.getParser().addLiteralOption(Value.Name, Value.Value,
693  Value.Description);
694  }
695 };
696 
697 /// Helper to build a ValuesClass by forwarding a variable number of arguments
698 /// as an initializer list to the ValuesClass constructor.
699 template <typename... OptsTy> ValuesClass values(OptsTy... Options) {
700  return ValuesClass({Options...});
701 }
702 
703 //===----------------------------------------------------------------------===//
704 // parser class - Parameterizable parser for different data types. By default,
705 // known data types (string, int, bool) have specialized parsers, that do what
706 // you would expect. The default parser, used for data types that are not
707 // built-in, uses a mapping table to map specific options to values, which is
708 // used, among other things, to handle enum types.
709 
710 //--------------------------------------------------
711 // generic_parser_base - This class holds all the non-generic code that we do
712 // not need replicated for every instance of the generic parser. This also
713 // allows us to put stuff into CommandLine.cpp
714 //
716 protected:
718  public:
720  : Name(name), HelpStr(helpStr) {}
723  };
724 
725 public:
727 
728  virtual ~generic_parser_base() = default;
729  // Base class should have virtual-destructor
730 
731  // getNumOptions - Virtual function implemented by generic subclass to
732  // indicate how many entries are in Values.
733  //
734  virtual unsigned getNumOptions() const = 0;
735 
736  // getOption - Return option name N.
737  virtual StringRef getOption(unsigned N) const = 0;
738 
739  // getDescription - Return description N
740  virtual StringRef getDescription(unsigned N) const = 0;
741 
742  // Return the width of the option tag for printing...
743  virtual size_t getOptionWidth(const Option &O) const;
744 
745  virtual const GenericOptionValue &getOptionValue(unsigned N) const = 0;
746 
747  // printOptionInfo - Print out information about this option. The
748  // to-be-maintained width is specified.
749  //
750  virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const;
751 
752  void printGenericOptionDiff(const Option &O, const GenericOptionValue &V,
753  const GenericOptionValue &Default,
754  size_t GlobalWidth) const;
755 
756  // printOptionDiff - print the value of an option and it's default.
757  //
758  // Template definition ensures that the option and default have the same
759  // DataType (via the same AnyOptionValue).
760  template <class AnyOptionValue>
761  void printOptionDiff(const Option &O, const AnyOptionValue &V,
762  const AnyOptionValue &Default,
763  size_t GlobalWidth) const {
764  printGenericOptionDiff(O, V, Default, GlobalWidth);
765  }
766 
767  void initialize() {}
768 
770  // If there has been no argstr specified, that means that we need to add an
771  // argument for every possible option. This ensures that our options are
772  // vectored to us.
773  if (!Owner.hasArgStr())
774  for (unsigned i = 0, e = getNumOptions(); i != e; ++i)
775  OptionNames.push_back(getOption(i));
776  }
777 
779  // If there is an ArgStr specified, then we are of the form:
780  //
781  // -opt=O2 or -opt O2 or -optO2
782  //
783  // In which case, the value is required. Otherwise if an arg str has not
784  // been specified, we are of the form:
785  //
786  // -O2 or O2 or -la (where -l and -a are separate options)
787  //
788  // If this is the case, we cannot allow a value.
789  //
790  if (Owner.hasArgStr())
791  return ValueRequired;
792  else
793  return ValueDisallowed;
794  }
795 
796  // findOption - Return the option number corresponding to the specified
797  // argument string. If the option is not found, getNumOptions() is returned.
798  //
799  unsigned findOption(StringRef Name);
800 
801 protected:
803 };
804 
805 // Default parser implementation - This implementation depends on having a
806 // mapping of recognized options to values of some sort. In addition to this,
807 // each entry in the mapping also tracks a help message that is printed with the
808 // command line option for -help. Because this is a simple mapping parser, the
809 // data type can be any unsupported type.
810 //
811 template <class DataType> class parser : public generic_parser_base {
812 protected:
813  class OptionInfo : public GenericOptionInfo {
814  public:
815  OptionInfo(StringRef name, DataType v, StringRef helpStr)
816  : GenericOptionInfo(name, helpStr), V(v) {}
817 
819  };
821 
822 public:
824 
825  using parser_data_type = DataType;
826 
827  // Implement virtual functions needed by generic_parser_base
828  unsigned getNumOptions() const override { return unsigned(Values.size()); }
829  StringRef getOption(unsigned N) const override { return Values[N].Name; }
830  StringRef getDescription(unsigned N) const override {
831  return Values[N].HelpStr;
832  }
833 
834  // getOptionValue - Return the value of option name N.
835  const GenericOptionValue &getOptionValue(unsigned N) const override {
836  return Values[N].V;
837  }
838 
839  // parse - Return true on error.
840  bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V) {
841  StringRef ArgVal;
842  if (Owner.hasArgStr())
843  ArgVal = Arg;
844  else
845  ArgVal = ArgName;
846 
847  for (size_t i = 0, e = Values.size(); i != e; ++i)
848  if (Values[i].Name == ArgVal) {
849  V = Values[i].V.getValue();
850  return false;
851  }
852 
853  return O.error("Cannot find option named '" + ArgVal + "'!");
854  }
855 
856  /// addLiteralOption - Add an entry to the mapping table.
857  ///
858  template <class DT>
859  void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr) {
860  assert(findOption(Name) == Values.size() && "Option already exists!");
861  OptionInfo X(Name, static_cast<DataType>(V), HelpStr);
862  Values.push_back(X);
864  }
865 
866  /// removeLiteralOption - Remove the specified option.
867  ///
869  unsigned N = findOption(Name);
870  assert(N != Values.size() && "Option not found!");
871  Values.erase(Values.begin() + N);
872  }
873 };
874 
875 //--------------------------------------------------
876 // basic_parser - Super class of parsers to provide boilerplate code
877 //
878 class basic_parser_impl { // non-template implementation of basic_parser<t>
879 public:
881 
882  virtual ~basic_parser_impl() {}
883 
885  return ValueRequired;
886  }
887 
889 
890  void initialize() {}
891 
892  // Return the width of the option tag for printing...
893  size_t getOptionWidth(const Option &O) const;
894 
895  // printOptionInfo - Print out information about this option. The
896  // to-be-maintained width is specified.
897  //
898  void printOptionInfo(const Option &O, size_t GlobalWidth) const;
899 
900  // printOptionNoValue - Print a placeholder for options that don't yet support
901  // printOptionDiff().
902  void printOptionNoValue(const Option &O, size_t GlobalWidth) const;
903 
904  // getValueName - Overload in subclass to provide a better default value.
905  virtual StringRef getValueName() const { return "value"; }
906 
907  // An out-of-line virtual method to provide a 'home' for this class.
908  virtual void anchor();
909 
910 protected:
911  // A helper for basic_parser::printOptionDiff.
912  void printOptionName(const Option &O, size_t GlobalWidth) const;
913 };
914 
915 // basic_parser - The real basic parser is just a template wrapper that provides
916 // a typedef for the provided data type.
917 //
918 template <class DataType> class basic_parser : public basic_parser_impl {
919 public:
920  using parser_data_type = DataType;
922 
924 };
925 
926 //--------------------------------------------------
927 // parser<bool>
928 //
929 
930 extern template class basic_parser<bool>;
931 
932 template <> class parser<bool> : public basic_parser<bool> {
933 public:
935 
936  // parse - Return true on error.
937  bool parse(Option &O, StringRef ArgName, StringRef Arg, bool &Val);
938 
939  void initialize() {}
940 
941  enum ValueExpected getValueExpectedFlagDefault() const {
942  return ValueOptional;
943  }
944 
945  // getValueName - Do not print =<value> at all.
946  StringRef getValueName() const override { return StringRef(); }
947 
948  void printOptionDiff(const Option &O, bool V, OptVal Default,
949  size_t GlobalWidth) const;
950 
951  // An out-of-line virtual method to provide a 'home' for this class.
952  void anchor() override;
953 };
954 
955 //--------------------------------------------------
956 // parser<boolOrDefault>
957 
958 extern template class basic_parser<boolOrDefault>;
959 
961 public:
963 
964  // parse - Return true on error.
965  bool parse(Option &O, StringRef ArgName, StringRef Arg, boolOrDefault &Val);
966 
967  enum ValueExpected getValueExpectedFlagDefault() const {
968  return ValueOptional;
969  }
970 
971  // getValueName - Do not print =<value> at all.
972  StringRef getValueName() const override { return StringRef(); }
973 
974  void printOptionDiff(const Option &O, boolOrDefault V, OptVal Default,
975  size_t GlobalWidth) const;
976 
977  // An out-of-line virtual method to provide a 'home' for this class.
978  void anchor() override;
979 };
980 
981 //--------------------------------------------------
982 // parser<int>
983 //
984 
985 extern template class basic_parser<int>;
986 
987 template <> class parser<int> : public basic_parser<int> {
988 public:
990 
991  // parse - Return true on error.
992  bool parse(Option &O, StringRef ArgName, StringRef Arg, int &Val);
993 
994  // getValueName - Overload in subclass to provide a better default value.
995  StringRef getValueName() const override { return "int"; }
996 
997  void printOptionDiff(const Option &O, int V, OptVal Default,
998  size_t GlobalWidth) const;
999 
1000  // An out-of-line virtual method to provide a 'home' for this class.
1001  void anchor() override;
1002 };
1003 
1004 //--------------------------------------------------
1005 // parser<long>
1006 //
1007 
1008 extern template class basic_parser<long>;
1009 
1010 template <> class parser<long> final : public basic_parser<long> {
1011 public:
1013 
1014  // parse - Return true on error.
1015  bool parse(Option &O, StringRef ArgName, StringRef Arg, long &Val);
1016 
1017  // getValueName - Overload in subclass to provide a better default value.
1018  StringRef getValueName() const override { return "long"; }
1019 
1020  void printOptionDiff(const Option &O, long V, OptVal Default,
1021  size_t GlobalWidth) const;
1022 
1023  // An out-of-line virtual method to provide a 'home' for this class.
1024  void anchor() override;
1025 };
1026 
1027 //--------------------------------------------------
1028 // parser<long long>
1029 //
1030 
1031 extern template class basic_parser<long long>;
1032 
1033 template <> class parser<long long> : public basic_parser<long long> {
1034 public:
1036 
1037  // parse - Return true on error.
1038  bool parse(Option &O, StringRef ArgName, StringRef Arg, long long &Val);
1039 
1040  // getValueName - Overload in subclass to provide a better default value.
1041  StringRef getValueName() const override { return "long"; }
1042 
1043  void printOptionDiff(const Option &O, long long V, OptVal Default,
1044  size_t GlobalWidth) const;
1045 
1046  // An out-of-line virtual method to provide a 'home' for this class.
1047  void anchor() override;
1048 };
1049 
1050 //--------------------------------------------------
1051 // parser<unsigned>
1052 //
1053 
1054 extern template class basic_parser<unsigned>;
1055 
1056 template <> class parser<unsigned> : public basic_parser<unsigned> {
1057 public:
1059 
1060  // parse - Return true on error.
1061  bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned &Val);
1062 
1063  // getValueName - Overload in subclass to provide a better default value.
1064  StringRef getValueName() const override { return "uint"; }
1065 
1066  void printOptionDiff(const Option &O, unsigned V, OptVal Default,
1067  size_t GlobalWidth) const;
1068 
1069  // An out-of-line virtual method to provide a 'home' for this class.
1070  void anchor() override;
1071 };
1072 
1073 //--------------------------------------------------
1074 // parser<unsigned long>
1075 //
1076 
1077 extern template class basic_parser<unsigned long>;
1078 
1079 template <>
1081 public:
1083 
1084  // parse - Return true on error.
1085  bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long &Val);
1086 
1087  // getValueName - Overload in subclass to provide a better default value.
1088  StringRef getValueName() const override { return "ulong"; }
1089 
1090  void printOptionDiff(const Option &O, unsigned long V, OptVal Default,
1091  size_t GlobalWidth) const;
1092 
1093  // An out-of-line virtual method to provide a 'home' for this class.
1094  void anchor() override;
1095 };
1096 
1097 //--------------------------------------------------
1098 // parser<unsigned long long>
1099 //
1100 
1101 extern template class basic_parser<unsigned long long>;
1102 
1103 template <>
1105 public:
1107 
1108  // parse - Return true on error.
1109  bool parse(Option &O, StringRef ArgName, StringRef Arg,
1110  unsigned long long &Val);
1111 
1112  // getValueName - Overload in subclass to provide a better default value.
1113  StringRef getValueName() const override { return "ulong"; }
1114 
1115  void printOptionDiff(const Option &O, unsigned long long V, OptVal Default,
1116  size_t GlobalWidth) const;
1117 
1118  // An out-of-line virtual method to provide a 'home' for this class.
1119  void anchor() override;
1120 };
1121 
1122 //--------------------------------------------------
1123 // parser<double>
1124 //
1125 
1126 extern template class basic_parser<double>;
1127 
1128 template <> class parser<double> : public basic_parser<double> {
1129 public:
1131 
1132  // parse - Return true on error.
1133  bool parse(Option &O, StringRef ArgName, StringRef Arg, double &Val);
1134 
1135  // getValueName - Overload in subclass to provide a better default value.
1136  StringRef getValueName() const override { return "number"; }
1137 
1138  void printOptionDiff(const Option &O, double V, OptVal Default,
1139  size_t GlobalWidth) const;
1140 
1141  // An out-of-line virtual method to provide a 'home' for this class.
1142  void anchor() override;
1143 };
1144 
1145 //--------------------------------------------------
1146 // parser<float>
1147 //
1148 
1149 extern template class basic_parser<float>;
1150 
1151 template <> class parser<float> : public basic_parser<float> {
1152 public:
1154 
1155  // parse - Return true on error.
1156  bool parse(Option &O, StringRef ArgName, StringRef Arg, float &Val);
1157 
1158  // getValueName - Overload in subclass to provide a better default value.
1159  StringRef getValueName() const override { return "number"; }
1160 
1161  void printOptionDiff(const Option &O, float V, OptVal Default,
1162  size_t GlobalWidth) const;
1163 
1164  // An out-of-line virtual method to provide a 'home' for this class.
1165  void anchor() override;
1166 };
1167 
1168 //--------------------------------------------------
1169 // parser<std::string>
1170 //
1171 
1172 extern template class basic_parser<std::string>;
1173 
1175 public:
1177 
1178  // parse - Return true on error.
1179  bool parse(Option &, StringRef, StringRef Arg, std::string &Value) {
1180  Value = Arg.str();
1181  return false;
1182  }
1183 
1184  // getValueName - Overload in subclass to provide a better default value.
1185  StringRef getValueName() const override { return "string"; }
1186 
1187  void printOptionDiff(const Option &O, StringRef V, const OptVal &Default,
1188  size_t GlobalWidth) const;
1189 
1190  // An out-of-line virtual method to provide a 'home' for this class.
1191  void anchor() override;
1192 };
1193 
1194 //--------------------------------------------------
1195 // parser<char>
1196 //
1197 
1198 extern template class basic_parser<char>;
1199 
1200 template <> class parser<char> : public basic_parser<char> {
1201 public:
1203 
1204  // parse - Return true on error.
1206  Value = Arg[0];
1207  return false;
1208  }
1209 
1210  // getValueName - Overload in subclass to provide a better default value.
1211  StringRef getValueName() const override { return "char"; }
1212 
1213  void printOptionDiff(const Option &O, char V, OptVal Default,
1214  size_t GlobalWidth) const;
1215 
1216  // An out-of-line virtual method to provide a 'home' for this class.
1217  void anchor() override;
1218 };
1219 
1220 //--------------------------------------------------
1221 // PrintOptionDiff
1222 //
1223 // This collection of wrappers is the intermediary between class opt and class
1224 // parser to handle all the template nastiness.
1225 
1226 // This overloaded function is selected by the generic parser.
1227 template <class ParserClass, class DT>
1228 void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V,
1229  const OptionValue<DT> &Default, size_t GlobalWidth) {
1230  OptionValue<DT> OV = V;
1231  P.printOptionDiff(O, OV, Default, GlobalWidth);
1232 }
1233 
1234 // This is instantiated for basic parsers when the parsed value has a different
1235 // type than the option value. e.g. HelpPrinter.
1236 template <class ParserDT, class ValDT> struct OptionDiffPrinter {
1237  void print(const Option &O, const parser<ParserDT> &P, const ValDT & /*V*/,
1238  const OptionValue<ValDT> & /*Default*/, size_t GlobalWidth) {
1239  P.printOptionNoValue(O, GlobalWidth);
1240  }
1241 };
1242 
1243 // This is instantiated for basic parsers when the parsed value has the same
1244 // type as the option value.
1245 template <class DT> struct OptionDiffPrinter<DT, DT> {
1246  void print(const Option &O, const parser<DT> &P, const DT &V,
1247  const OptionValue<DT> &Default, size_t GlobalWidth) {
1248  P.printOptionDiff(O, V, Default, GlobalWidth);
1249  }
1250 };
1251 
1252 // This overloaded function is selected by the basic parser, which may parse a
1253 // different type than the option type.
1254 template <class ParserClass, class ValDT>
1256  const Option &O,
1258  const ValDT &V, const OptionValue<ValDT> &Default, size_t GlobalWidth) {
1259 
1261  printer.print(O, static_cast<const ParserClass &>(P), V, Default,
1262  GlobalWidth);
1263 }
1264 
1265 //===----------------------------------------------------------------------===//
1266 // applicator class - This class is used because we must use partial
1267 // specialization to handle literal string arguments specially (const char* does
1268 // not correctly respond to the apply method). Because the syntax to use this
1269 // is a pain, we have the 'apply' method below to handle the nastiness...
1270 //
1271 template <class Mod> struct applicator {
1272  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
1273 };
1274 
1275 // Handle const char* as a special case...
1276 template <unsigned n> struct applicator<char[n]> {
1277  template <class Opt> static void opt(StringRef Str, Opt &O) {
1278  O.setArgStr(Str);
1279  }
1280 };
1281 template <unsigned n> struct applicator<const char[n]> {
1282  template <class Opt> static void opt(StringRef Str, Opt &O) {
1283  O.setArgStr(Str);
1284  }
1285 };
1286 template <> struct applicator<StringRef > {
1287  template <class Opt> static void opt(StringRef Str, Opt &O) {
1288  O.setArgStr(Str);
1289  }
1290 };
1291 
1293  static void opt(NumOccurrencesFlag N, Option &O) {
1294  O.setNumOccurrencesFlag(N);
1295  }
1296 };
1297 
1298 template <> struct applicator<ValueExpected> {
1299  static void opt(ValueExpected VE, Option &O) { O.setValueExpectedFlag(VE); }
1300 };
1301 
1302 template <> struct applicator<OptionHidden> {
1303  static void opt(OptionHidden OH, Option &O) { O.setHiddenFlag(OH); }
1304 };
1305 
1306 template <> struct applicator<FormattingFlags> {
1307  static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
1308 };
1309 
1310 template <> struct applicator<MiscFlags> {
1311  static void opt(MiscFlags MF, Option &O) {
1312  assert((MF != Grouping || O.ArgStr.size() == 1) &&
1313  "cl::Grouping can only apply to single charater Options.");
1314  O.setMiscFlag(MF);
1315  }
1316 };
1317 
1318 // apply method - Apply modifiers to an option in a type safe way.
1319 template <class Opt, class Mod, class... Mods>
1320 void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1322  apply(O, Ms...);
1323 }
1324 
1325 template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1327 }
1328 
1329 //===----------------------------------------------------------------------===//
1330 // opt_storage class
1331 
1332 // Default storage class definition: external storage. This implementation
1333 // assumes the user will specify a variable to store the data into with the
1334 // cl::location(x) modifier.
1335 //
1336 template <class DataType, bool ExternalStorage, bool isClass>
1338  DataType *Location = nullptr; // Where to store the object...
1339  OptionValue<DataType> Default;
1340 
1341  void check_location() const {
1342  assert(Location && "cl::location(...) not specified for a command "
1343  "line option with external storage, "
1344  "or cl::init specified before cl::location()!!");
1345  }
1346 
1347 public:
1348  opt_storage() = default;
1349 
1350  bool setLocation(Option &O, DataType &L) {
1351  if (Location)
1352  return O.error("cl::location(x) specified more than once!");
1353  Location = &L;
1354  Default = L;
1355  return false;
1356  }
1357 
1358  template <class T> void setValue(const T &V, bool initial = false) {
1359  check_location();
1360  *Location = V;
1361  if (initial)
1362  Default = V;
1363  }
1364 
1365  DataType &getValue() {
1366  check_location();
1367  return *Location;
1368  }
1369  const DataType &getValue() const {
1370  check_location();
1371  return *Location;
1372  }
1373 
1374  operator DataType() const { return this->getValue(); }
1375 
1376  const OptionValue<DataType> &getDefault() const { return Default; }
1377 };
1378 
1379 // Define how to hold a class type object, such as a string. Since we can
1380 // inherit from a class, we do so. This makes us exactly compatible with the
1381 // object in all cases that it is used.
1382 //
1383 template <class DataType>
1384 class opt_storage<DataType, false, true> : public DataType {
1385 public:
1387 
1388  template <class T> void setValue(const T &V, bool initial = false) {
1389  DataType::operator=(V);
1390  if (initial)
1391  Default = V;
1392  }
1393 
1394  DataType &getValue() { return *this; }
1395  const DataType &getValue() const { return *this; }
1396 
1397  const OptionValue<DataType> &getDefault() const { return Default; }
1398 };
1399 
1400 // Define a partial specialization to handle things we cannot inherit from. In
1401 // this case, we store an instance through containment, and overload operators
1402 // to get at the value.
1403 //
1404 template <class DataType> class opt_storage<DataType, false, false> {
1405 public:
1406  DataType Value;
1408 
1409  // Make sure we initialize the value with the default constructor for the
1410  // type.
1411  opt_storage() : Value(DataType()), Default(DataType()) {}
1412 
1413  template <class T> void setValue(const T &V, bool initial = false) {
1414  Value = V;
1415  if (initial)
1416  Default = V;
1417  }
1418  DataType &getValue() { return Value; }
1419  DataType getValue() const { return Value; }
1420 
1421  const OptionValue<DataType> &getDefault() const { return Default; }
1422 
1423  operator DataType() const { return getValue(); }
1424 
1425  // If the datatype is a pointer, support -> on it.
1426  DataType operator->() const { return Value; }
1427 };
1428 
1429 //===----------------------------------------------------------------------===//
1430 // opt - A scalar command line option.
1431 //
1432 template <class DataType, bool ExternalStorage = false,
1433  class ParserClass = parser<DataType>>
1434 class opt : public Option,
1435  public opt_storage<DataType, ExternalStorage,
1436  std::is_class<DataType>::value> {
1437  ParserClass Parser;
1438 
1439  bool handleOccurrence(unsigned pos, StringRef ArgName,
1440  StringRef Arg) override {
1441  typename ParserClass::parser_data_type Val =
1442  typename ParserClass::parser_data_type();
1443  if (Parser.parse(*this, ArgName, Arg, Val))
1444  return true; // Parse error!
1445  this->setValue(Val);
1446  this->setPosition(pos);
1447  Callback(Val);
1448  return false;
1449  }
1450 
1451  enum ValueExpected getValueExpectedFlagDefault() const override {
1452  return Parser.getValueExpectedFlagDefault();
1453  }
1454 
1455  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override {
1456  return Parser.getExtraOptionNames(OptionNames);
1457  }
1458 
1459  // Forward printing stuff to the parser...
1460  size_t getOptionWidth() const override {
1461  return Parser.getOptionWidth(*this);
1462  }
1463 
1464  void printOptionInfo(size_t GlobalWidth) const override {
1465  Parser.printOptionInfo(*this, GlobalWidth);
1466  }
1467 
1468  void printOptionValue(size_t GlobalWidth, bool Force) const override {
1469  if (Force || this->getDefault().compare(this->getValue())) {
1470  cl::printOptionDiff<ParserClass>(*this, Parser, this->getValue(),
1471  this->getDefault(), GlobalWidth);
1472  }
1473  }
1474 
1475  template <class T,
1476  class = std::enable_if_t<std::is_assignable<T &, T>::value>>
1477  void setDefaultImpl() {
1478  const OptionValue<DataType> &V = this->getDefault();
1479  if (V.hasValue())
1480  this->setValue(V.getValue());
1481  }
1482 
1483  template <class T,
1484  class = std::enable_if_t<!std::is_assignable<T &, T>::value>>
1485  void setDefaultImpl(...) {}
1486 
1487  void setDefault() override { setDefaultImpl<DataType>(); }
1488 
1489  void done() {
1490  addArgument();
1491  Parser.initialize();
1492  }
1493 
1494 public:
1495  // Command line options should not be copyable
1496  opt(const opt &) = delete;
1497  opt &operator=(const opt &) = delete;
1498 
1499  // setInitialValue - Used by the cl::init modifier...
1500  void setInitialValue(const DataType &V) { this->setValue(V, true); }
1501 
1502  ParserClass &getParser() { return Parser; }
1503 
1504  template <class T> DataType &operator=(const T &Val) {
1505  this->setValue(Val);
1506  Callback(Val);
1507  return this->getValue();
1508  }
1509 
1510  template <class... Mods>
1511  explicit opt(const Mods &... Ms)
1512  : Option(llvm::cl::Optional, NotHidden), Parser(*this) {
1513  apply(this, Ms...);
1514  done();
1515  }
1516 
1518  std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1519  Callback = CB;
1520  }
1521 
1522  std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1523  [](const typename ParserClass::parser_data_type &) {};
1524 };
1525 
1526 extern template class opt<unsigned>;
1527 extern template class opt<int>;
1528 extern template class opt<std::string>;
1529 extern template class opt<char>;
1530 extern template class opt<bool>;
1531 
1532 //===----------------------------------------------------------------------===//
1533 // list_storage class
1534 
1535 // Default storage class definition: external storage. This implementation
1536 // assumes the user will specify a variable to store the data into with the
1537 // cl::location(x) modifier.
1538 //
1539 template <class DataType, class StorageClass> class list_storage {
1540  StorageClass *Location = nullptr; // Where to store the object...
1541 
1542 public:
1543  list_storage() = default;
1544 
1545  void clear() {}
1546 
1548  if (Location)
1549  return O.error("cl::location(x) specified more than once!");
1550  Location = &L;
1551  return false;
1552  }
1553 
1554  template <class T> void addValue(const T &V) {
1555  assert(Location != 0 && "cl::location(...) not specified for a command "
1556  "line option with external storage!");
1557  Location->push_back(V);
1558  }
1559 };
1560 
1561 // Define how to hold a class type object, such as a string.
1562 // Originally this code inherited from std::vector. In transitioning to a new
1563 // API for command line options we should change this. The new implementation
1564 // of this list_storage specialization implements the minimum subset of the
1565 // std::vector API required for all the current clients.
1566 //
1567 // FIXME: Reduce this API to a more narrow subset of std::vector
1568 //
1569 template <class DataType> class list_storage<DataType, bool> {
1570  std::vector<DataType> Storage;
1571 
1572 public:
1573  using iterator = typename std::vector<DataType>::iterator;
1574 
1575  iterator begin() { return Storage.begin(); }
1576  iterator end() { return Storage.end(); }
1577 
1578  using const_iterator = typename std::vector<DataType>::const_iterator;
1579 
1580  const_iterator begin() const { return Storage.begin(); }
1581  const_iterator end() const { return Storage.end(); }
1582 
1583  using size_type = typename std::vector<DataType>::size_type;
1584 
1585  size_type size() const { return Storage.size(); }
1586 
1587  bool empty() const { return Storage.empty(); }
1588 
1589  void push_back(const DataType &value) { Storage.push_back(value); }
1590  void push_back(DataType &&value) { Storage.push_back(value); }
1591 
1592  using reference = typename std::vector<DataType>::reference;
1593  using const_reference = typename std::vector<DataType>::const_reference;
1594 
1595  reference operator[](size_type pos) { return Storage[pos]; }
1596  const_reference operator[](size_type pos) const { return Storage[pos]; }
1597 
1598  void clear() {
1599  Storage.clear();
1600  }
1601 
1602  iterator erase(const_iterator pos) { return Storage.erase(pos); }
1604  return Storage.erase(first, last);
1605  }
1606 
1607  iterator erase(iterator pos) { return Storage.erase(pos); }
1609  return Storage.erase(first, last);
1610  }
1611 
1612  iterator insert(const_iterator pos, const DataType &value) {
1613  return Storage.insert(pos, value);
1614  }
1615  iterator insert(const_iterator pos, DataType &&value) {
1616  return Storage.insert(pos, value);
1617  }
1618 
1619  iterator insert(iterator pos, const DataType &value) {
1620  return Storage.insert(pos, value);
1621  }
1622  iterator insert(iterator pos, DataType &&value) {
1623  return Storage.insert(pos, value);
1624  }
1625 
1626  reference front() { return Storage.front(); }
1627  const_reference front() const { return Storage.front(); }
1628 
1629  operator std::vector<DataType> &() { return Storage; }
1630  operator ArrayRef<DataType>() const { return Storage; }
1631  std::vector<DataType> *operator&() { return &Storage; }
1632  const std::vector<DataType> *operator&() const { return &Storage; }
1633 
1634  template <class T> void addValue(const T &V) { Storage.push_back(V); }
1635 };
1636 
1637 //===----------------------------------------------------------------------===//
1638 // list - A list of command line options.
1639 //
1640 template <class DataType, class StorageClass = bool,
1641  class ParserClass = parser<DataType>>
1642 class list : public Option, public list_storage<DataType, StorageClass> {
1643  std::vector<unsigned> Positions;
1644  ParserClass Parser;
1645 
1646  enum ValueExpected getValueExpectedFlagDefault() const override {
1647  return Parser.getValueExpectedFlagDefault();
1648  }
1649 
1650  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override {
1651  return Parser.getExtraOptionNames(OptionNames);
1652  }
1653 
1654  bool handleOccurrence(unsigned pos, StringRef ArgName,
1655  StringRef Arg) override {
1656  typename ParserClass::parser_data_type Val =
1657  typename ParserClass::parser_data_type();
1658  if (Parser.parse(*this, ArgName, Arg, Val))
1659  return true; // Parse Error!
1661  setPosition(pos);
1662  Positions.push_back(pos);
1663  Callback(Val);
1664  return false;
1665  }
1666 
1667  // Forward printing stuff to the parser...
1668  size_t getOptionWidth() const override {
1669  return Parser.getOptionWidth(*this);
1670  }
1671 
1672  void printOptionInfo(size_t GlobalWidth) const override {
1673  Parser.printOptionInfo(*this, GlobalWidth);
1674  }
1675 
1676  // Unimplemented: list options don't currently store their default value.
1677  void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
1678  }
1679 
1680  void setDefault() override {
1681  Positions.clear();
1683  }
1684 
1685  void done() {
1686  addArgument();
1687  Parser.initialize();
1688  }
1689 
1690 public:
1691  // Command line options should not be copyable
1692  list(const list &) = delete;
1693  list &operator=(const list &) = delete;
1694 
1695  ParserClass &getParser() { return Parser; }
1696 
1697  unsigned getPosition(unsigned optnum) const {
1698  assert(optnum < this->size() && "Invalid option index");
1699  return Positions[optnum];
1700  }
1701 
1703 
1704  template <class... Mods>
1705  explicit list(const Mods &... Ms)
1706  : Option(ZeroOrMore, NotHidden), Parser(*this) {
1707  apply(this, Ms...);
1708  done();
1709  }
1710 
1712  std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1713  Callback = CB;
1714  }
1715 
1716  std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1717  [](const typename ParserClass::parser_data_type &) {};
1718 };
1719 
1720 // multi_val - Modifier to set the number of additional values.
1721 struct multi_val {
1722  unsigned AdditionalVals;
1723  explicit multi_val(unsigned N) : AdditionalVals(N) {}
1724 
1725  template <typename D, typename S, typename P>
1726  void apply(list<D, S, P> &L) const {
1728  }
1729 };
1730 
1731 //===----------------------------------------------------------------------===//
1732 // bits_storage class
1733 
1734 // Default storage class definition: external storage. This implementation
1735 // assumes the user will specify a variable to store the data into with the
1736 // cl::location(x) modifier.
1737 //
1738 template <class DataType, class StorageClass> class bits_storage {
1739  unsigned *Location = nullptr; // Where to store the bits...
1740 
1741  template <class T> static unsigned Bit(const T &V) {
1742  unsigned BitPos = reinterpret_cast<unsigned>(V);
1743  assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
1744  "enum exceeds width of bit vector!");
1745  return 1 << BitPos;
1746  }
1747 
1748 public:
1749  bits_storage() = default;
1750 
1751  bool setLocation(Option &O, unsigned &L) {
1752  if (Location)
1753  return O.error("cl::location(x) specified more than once!");
1754  Location = &L;
1755  return false;
1756  }
1757 
1758  template <class T> void addValue(const T &V) {
1759  assert(Location != 0 && "cl::location(...) not specified for a command "
1760  "line option with external storage!");
1761  *Location |= Bit(V);
1762  }
1763 
1764  unsigned getBits() { return *Location; }
1765 
1766  template <class T> bool isSet(const T &V) {
1767  return (*Location & Bit(V)) != 0;
1768  }
1769 };
1770 
1771 // Define how to hold bits. Since we can inherit from a class, we do so.
1772 // This makes us exactly compatible with the bits in all cases that it is used.
1773 //
1774 template <class DataType> class bits_storage<DataType, bool> {
1775  unsigned Bits; // Where to store the bits...
1776 
1777  template <class T> static unsigned Bit(const T &V) {
1778  unsigned BitPos = (unsigned)V;
1779  assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
1780  "enum exceeds width of bit vector!");
1781  return 1 << BitPos;
1782  }
1783 
1784 public:
1785  template <class T> void addValue(const T &V) { Bits |= Bit(V); }
1786 
1787  unsigned getBits() { return Bits; }
1788 
1789  template <class T> bool isSet(const T &V) { return (Bits & Bit(V)) != 0; }
1790 };
1791 
1792 //===----------------------------------------------------------------------===//
1793 // bits - A bit vector of command options.
1794 //
1795 template <class DataType, class Storage = bool,
1796  class ParserClass = parser<DataType>>
1797 class bits : public Option, public bits_storage<DataType, Storage> {
1798  std::vector<unsigned> Positions;
1799  ParserClass Parser;
1800 
1801  enum ValueExpected getValueExpectedFlagDefault() const override {
1802  return Parser.getValueExpectedFlagDefault();
1803  }
1804 
1805  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override {
1806  return Parser.getExtraOptionNames(OptionNames);
1807  }
1808 
1809  bool handleOccurrence(unsigned pos, StringRef ArgName,
1810  StringRef Arg) override {
1811  typename ParserClass::parser_data_type Val =
1812  typename ParserClass::parser_data_type();
1813  if (Parser.parse(*this, ArgName, Arg, Val))
1814  return true; // Parse Error!
1815  this->addValue(Val);
1816  setPosition(pos);
1817  Positions.push_back(pos);
1818  Callback(Val);
1819  return false;
1820  }
1821 
1822  // Forward printing stuff to the parser...
1823  size_t getOptionWidth() const override {
1824  return Parser.getOptionWidth(*this);
1825  }
1826 
1827  void printOptionInfo(size_t GlobalWidth) const override {
1828  Parser.printOptionInfo(*this, GlobalWidth);
1829  }
1830 
1831  // Unimplemented: bits options don't currently store their default values.
1832  void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
1833  }
1834 
1835  void setDefault() override {}
1836 
1837  void done() {
1838  addArgument();
1839  Parser.initialize();
1840  }
1841 
1842 public:
1843  // Command line options should not be copyable
1844  bits(const bits &) = delete;
1845  bits &operator=(const bits &) = delete;
1846 
1847  ParserClass &getParser() { return Parser; }
1848 
1849  unsigned getPosition(unsigned optnum) const {
1850  assert(optnum < this->size() && "Invalid option index");
1851  return Positions[optnum];
1852  }
1853 
1854  template <class... Mods>
1855  explicit bits(const Mods &... Ms)
1856  : Option(ZeroOrMore, NotHidden), Parser(*this) {
1857  apply(this, Ms...);
1858  done();
1859  }
1860 
1862  std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1863  Callback = CB;
1864  }
1865 
1866  std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1867  [](const typename ParserClass::parser_data_type &) {};
1868 };
1869 
1870 //===----------------------------------------------------------------------===//
1871 // Aliased command line option (alias this name to a preexisting name)
1872 //
1873 
1874 class alias : public Option {
1875  Option *AliasFor;
1876 
1877  bool handleOccurrence(unsigned pos, StringRef /*ArgName*/,
1878  StringRef Arg) override {
1879  return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
1880  }
1881 
1882  bool addOccurrence(unsigned pos, StringRef /*ArgName*/, StringRef Value,
1883  bool MultiArg = false) override {
1884  return AliasFor->addOccurrence(pos, AliasFor->ArgStr, Value, MultiArg);
1885  }
1886 
1887  // Handle printing stuff...
1888  size_t getOptionWidth() const override;
1889  void printOptionInfo(size_t GlobalWidth) const override;
1890 
1891  // Aliases do not need to print their values.
1892  void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
1893  }
1894 
1895  void setDefault() override { AliasFor->setDefault(); }
1896 
1897  ValueExpected getValueExpectedFlagDefault() const override {
1898  return AliasFor->getValueExpectedFlag();
1899  }
1900 
1901  void done() {
1902  if (!hasArgStr())
1903  error("cl::alias must have argument name specified!");
1904  if (!AliasFor)
1905  error("cl::alias must have an cl::aliasopt(option) specified!");
1906  if (!Subs.empty())
1907  error("cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
1908  Subs = AliasFor->Subs;
1909  Categories = AliasFor->Categories;
1910  addArgument();
1911  }
1912 
1913 public:
1914  // Command line options should not be copyable
1915  alias(const alias &) = delete;
1916  alias &operator=(const alias &) = delete;
1917 
1919  if (AliasFor)
1920  error("cl::alias must only have one cl::aliasopt(...) specified!");
1921  AliasFor = &O;
1922  }
1923 
1924  template <class... Mods>
1925  explicit alias(const Mods &... Ms)
1926  : Option(Optional, Hidden), AliasFor(nullptr) {
1927  apply(this, Ms...);
1928  done();
1929  }
1930 };
1931 
1932 // aliasfor - Modifier to set the option an alias aliases.
1933 struct aliasopt {
1935 
1936  explicit aliasopt(Option &O) : Opt(O) {}
1937 
1938  void apply(alias &A) const { A.setAliasFor(Opt); }
1939 };
1940 
1941 // extrahelp - provide additional help at the end of the normal help
1942 // output. All occurrences of cl::extrahelp will be accumulated and
1943 // printed to stderr at the end of the regular help, just before
1944 // exit is called.
1945 struct extrahelp {
1947 
1948  explicit extrahelp(StringRef help);
1949 };
1950 
1951 void PrintVersionMessage();
1952 
1953 /// This function just prints the help message, exactly the same way as if the
1954 /// -help or -help-hidden option had been given on the command line.
1955 ///
1956 /// \param Hidden if true will print hidden options
1957 /// \param Categorized if true print options in categories
1958 void PrintHelpMessage(bool Hidden = false, bool Categorized = false);
1959 
1960 //===----------------------------------------------------------------------===//
1961 // Public interface for accessing registered options.
1962 //
1963 
1964 /// Use this to get a StringMap to all registered named options
1965 /// (e.g. -help).
1966 ///
1967 /// \return A reference to the StringMap used by the cl APIs to parse options.
1968 ///
1969 /// Access to unnamed arguments (i.e. positional) are not provided because
1970 /// it is expected that the client already has access to these.
1971 ///
1972 /// Typical usage:
1973 /// \code
1974 /// main(int argc,char* argv[]) {
1975 /// StringMap<llvm::cl::Option*> &opts = llvm::cl::getRegisteredOptions();
1976 /// assert(opts.count("help") == 1)
1977 /// opts["help"]->setDescription("Show alphabetical help information")
1978 /// // More code
1979 /// llvm::cl::ParseCommandLineOptions(argc,argv);
1980 /// //More code
1981 /// }
1982 /// \endcode
1983 ///
1984 /// This interface is useful for modifying options in libraries that are out of
1985 /// the control of the client. The options should be modified before calling
1986 /// llvm::cl::ParseCommandLineOptions().
1987 ///
1988 /// Hopefully this API can be deprecated soon. Any situation where options need
1989 /// to be modified by tools or libraries should be handled by sane APIs rather
1990 /// than just handing around a global list.
1992 
1993 /// Use this to get all registered SubCommands from the provided parser.
1994 ///
1995 /// \return A range of all SubCommand pointers registered with the parser.
1996 ///
1997 /// Typical usage:
1998 /// \code
1999 /// main(int argc, char* argv[]) {
2000 /// llvm::cl::ParseCommandLineOptions(argc, argv);
2001 /// for (auto* S : llvm::cl::getRegisteredSubcommands()) {
2002 /// if (*S) {
2003 /// std::cout << "Executing subcommand: " << S->getName() << std::endl;
2004 /// // Execute some function based on the name...
2005 /// }
2006 /// }
2007 /// }
2008 /// \endcode
2009 ///
2010 /// This interface is useful for defining subcommands in libraries and
2011 /// the dispatch from a single point (like in the main function).
2014 
2015 //===----------------------------------------------------------------------===//
2016 // Standalone command line processing utilities.
2017 //
2018 
2019 /// Tokenizes a command line that can contain escapes and quotes.
2020 //
2021 /// The quoting rules match those used by GCC and other tools that use
2022 /// libiberty's buildargv() or expandargv() utilities, and do not match bash.
2023 /// They differ from buildargv() on treatment of backslashes that do not escape
2024 /// a special character to make it possible to accept most Windows file paths.
2025 ///
2026 /// \param [in] Source The string to be split on whitespace with quotes.
2027 /// \param [in] Saver Delegates back to the caller for saving parsed strings.
2028 /// \param [in] MarkEOLs true if tokenizing a response file and you want end of
2029 /// lines and end of the response file to be marked with a nullptr string.
2030 /// \param [out] NewArgv All parsed strings are appended to NewArgv.
2033  bool MarkEOLs = false);
2034 
2035 /// Tokenizes a Windows command line which may contain quotes and escaped
2036 /// quotes.
2037 ///
2038 /// See MSDN docs for CommandLineToArgvW for information on the quoting rules.
2039 /// http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx
2040 ///
2041 /// \param [in] Source The string to be split on whitespace with quotes.
2042 /// \param [in] Saver Delegates back to the caller for saving parsed strings.
2043 /// \param [in] MarkEOLs true if tokenizing a response file and you want end of
2044 /// lines and end of the response file to be marked with a nullptr string.
2045 /// \param [out] NewArgv All parsed strings are appended to NewArgv.
2048  bool MarkEOLs = false);
2049 
2050 /// Tokenizes a Windows command line while attempting to avoid copies. If no
2051 /// quoting or escaping was used, this produces substrings of the original
2052 /// string. If a token requires unquoting, it will be allocated with the
2053 /// StringSaver.
2055  SmallVectorImpl<StringRef> &NewArgv);
2056 
2057 /// String tokenization function type. Should be compatible with either
2058 /// Windows or Unix command line tokenizers.
2059 using TokenizerCallback = void (*)(StringRef Source, StringSaver &Saver,
2061  bool MarkEOLs);
2062 
2063 /// Tokenizes content of configuration file.
2064 ///
2065 /// \param [in] Source The string representing content of config file.
2066 /// \param [in] Saver Delegates back to the caller for saving parsed strings.
2067 /// \param [out] NewArgv All parsed strings are appended to NewArgv.
2068 /// \param [in] MarkEOLs Added for compatibility with TokenizerCallback.
2069 ///
2070 /// It works like TokenizeGNUCommandLine with ability to skip comment lines.
2071 ///
2074  bool MarkEOLs = false);
2075 
2076 /// Reads command line options from the given configuration file.
2077 ///
2078 /// \param [in] CfgFileName Path to configuration file.
2079 /// \param [in] Saver Objects that saves allocated strings.
2080 /// \param [out] Argv Array to which the read options are added.
2081 /// \return true if the file was successfully read.
2082 ///
2083 /// It reads content of the specified file, tokenizes it and expands "@file"
2084 /// commands resolving file names in them relative to the directory where
2085 /// CfgFilename resides.
2086 ///
2087 bool readConfigFile(StringRef CfgFileName, StringSaver &Saver,
2089 
2090 /// Expand response files on a command line recursively using the given
2091 /// StringSaver and tokenization strategy. Argv should contain the command line
2092 /// before expansion and will be modified in place. If requested, Argv will
2093 /// also be populated with nullptrs indicating where each response file line
2094 /// ends, which is useful for the "/link" argument that needs to consume all
2095 /// remaining arguments only until the next end of line, when in a response
2096 /// file.
2097 ///
2098 /// \param [in] Saver Delegates back to the caller for saving parsed strings.
2099 /// \param [in] Tokenizer Tokenization strategy. Typically Unix or Windows.
2100 /// \param [in,out] Argv Command line into which to expand response files.
2101 /// \param [in] MarkEOLs Mark end of lines and the end of the response file
2102 /// with nullptrs in the Argv vector.
2103 /// \param [in] RelativeNames true if names of nested response files must be
2104 /// resolved relative to including file.
2105 /// \param [in] FS File system used for all file access when running the tool.
2106 /// \param [in] CurrentDir Path used to resolve relative rsp files. If set to
2107 /// None, process' cwd is used instead.
2108 /// \return true if all @files were expanded successfully or there were none.
2109 bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer,
2110  SmallVectorImpl<const char *> &Argv, bool MarkEOLs,
2111  bool RelativeNames,
2114 
2115 /// An overload of ExpandResponseFiles() that uses
2116 /// llvm::vfs::getRealFileSystem().
2117 bool ExpandResponseFiles(
2118  StringSaver &Saver, TokenizerCallback Tokenizer,
2119  SmallVectorImpl<const char *> &Argv, bool MarkEOLs = false,
2120  bool RelativeNames = false,
2122 
2123 /// A convenience helper which concatenates the options specified by the
2124 /// environment variable EnvVar and command line options, then expands response
2125 /// files recursively. The tokenizer is a predefined GNU or Windows one.
2126 /// \return true if all @files were expanded successfully or there were none.
2127 bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar,
2128  StringSaver &Saver,
2130 
2131 /// Mark all options not part of this category as cl::ReallyHidden.
2132 ///
2133 /// \param Category the category of options to keep displaying
2134 ///
2135 /// Some tools (like clang-format) like to be able to hide all options that are
2136 /// not specific to the tool. This function allows a tool to specify a single
2137 /// option category to display in the -help output.
2139  SubCommand &Sub = *TopLevelSubCommand);
2140 
2141 /// Mark all options not part of the categories as cl::ReallyHidden.
2142 ///
2143 /// \param Categories the categories of options to keep displaying.
2144 ///
2145 /// Some tools (like clang-format) like to be able to hide all options that are
2146 /// not specific to the tool. This function allows a tool to specify a single
2147 /// option category to display in the -help output.
2149  SubCommand &Sub = *TopLevelSubCommand);
2150 
2151 /// Reset all command line options to a state that looks as if they have
2152 /// never appeared on the command line. This is useful for being able to parse
2153 /// a command line multiple times (especially useful for writing tests).
2155 
2156 /// Reset the command line parser back to its initial state. This
2157 /// removes
2158 /// all options, categories, and subcommands and returns the parser to a state
2159 /// where no options are supported.
2160 void ResetCommandLineParser();
2161 
2162 /// Parses `Arg` into the option handler `Handler`.
2163 bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i);
2164 
2165 } // end namespace cl
2166 
2167 } // end namespace llvm
2168 
2169 #endif // LLVM_SUPPORT_COMMANDLINE_H
llvm::cl::MiscFlags
MiscFlags
Definition: CommandLine.h:168
llvm::cl::readConfigFile
bool readConfigFile(StringRef CfgFileName, StringSaver &Saver, SmallVectorImpl< const char * > &Argv)
Reads command line options from the given configuration file.
Definition: CommandLine.cpp:1276
i
i
Definition: README.txt:29
llvm::cl::basic_parser_impl::getExtraOptionNames
void getExtraOptionNames(SmallVectorImpl< StringRef > &)
Definition: CommandLine.h:888
llvm::cl::Option::getPosition
unsigned getPosition() const
Definition: CommandLine.h:305
llvm::cl::AddExtraVersionPrinter
void AddExtraVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// AddExtraVersionPrinter - ...
Definition: CommandLine.cpp:2639
llvm::cl::generic_parser_base
Definition: CommandLine.h:715
llvm::cl::SubCommand::reset
void reset()
Definition: CommandLine.cpp:503
llvm::cl::DefaultOption
@ DefaultOption
Definition: CommandLine.h:180
llvm::cl::ExpandResponseFiles
bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv, bool MarkEOLs, bool RelativeNames, llvm::Optional< llvm::StringRef > CurrentDir, llvm::vfs::FileSystem &FS)
Expand response files on a command line recursively using the given StringSaver and tokenization stra...
Definition: CommandLine.cpp:1139
llvm::cl::value_desc::Desc
StringRef Desc
Definition: CommandLine.h:425
llvm::cl::cb::apply
void apply(Opt &O) const
Definition: CommandLine.h:489
llvm::cl::opt_storage< DataType, false, true >::getDefault
const OptionValue< DataType > & getDefault() const
Definition: CommandLine.h:1397
llvm::cl::parser::parse
bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V)
Definition: CommandLine.h:840
llvm::cl::generic_parser_base::getOptionValue
virtual const GenericOptionValue & getOptionValue(unsigned N) const =0
llvm::cl::extrahelp::extrahelp
extrahelp(StringRef help)
Definition: CommandLine.cpp:443
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::cl::list_storage< DataType, bool >::erase
iterator erase(iterator first, iterator last)
Definition: CommandLine.h:1608
llvm::cl::OptionDiffPrinter< DT, DT >::print
void print(const Option &O, const parser< DT > &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
Definition: CommandLine.h:1246
llvm::cl::parser::getDescription
StringRef getDescription(unsigned N) const override
Definition: CommandLine.h:830
llvm::cl::SubCommand::OptionsMap
StringMap< Option * > OptionsMap
Definition: CommandLine.h:235
llvm::cl::list::list
list(const list &)=delete
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::cl::aliasopt::aliasopt
aliasopt(Option &O)
Definition: CommandLine.h:1936
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::cl::Option::Categories
SmallVector< OptionCategory *, 1 > Categories
Definition: CommandLine.h:285
Optional.h
llvm::cl::parser::getNumOptions
unsigned getNumOptions() const override
Definition: CommandLine.h:828
llvm::cl::opt::operator=
DataType & operator=(const T &Val)
Definition: CommandLine.h:1504
llvm::cl::basic_parser_impl::getValueExpectedFlagDefault
enum ValueExpected getValueExpectedFlagDefault() const
Definition: CommandLine.h:884
llvm::cl::opt_storage< DataType, false, false >::operator->
DataType operator->() const
Definition: CommandLine.h:1426
llvm::cl::basic_parser_impl::anchor
virtual void anchor()
Definition: CommandLine.cpp:86
llvm::cl::value_desc::apply
void apply(Option &O) const
Definition: CommandLine.h:429
llvm::cl::cat::Category
OptionCategory & Category
Definition: CommandLine.h:466
llvm::cl::alias::alias
alias(const Mods &... Ms)
Definition: CommandLine.h:1925
llvm::cl::desc::desc
desc(StringRef Str)
Definition: CommandLine.h:417
llvm::cl::list_storage< DataType, bool >::reference
typename std::vector< DataType >::reference reference
Definition: CommandLine.h:1592
llvm::cl::parser< unsigned long long >::parser
parser(Option &O)
Definition: CommandLine.h:1106
llvm::cl::parser< unsigned long long >
Definition: CommandLine.h:1104
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:164
llvm::cl::OptionHidden
OptionHidden
Definition: CommandLine.h:141
llvm::cl::Option::addOccurrence
virtual bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg=false)
Definition: CommandLine.cpp:1696
llvm::cl::SubCommand::PositionalOpts
SmallVector< Option *, 4 > PositionalOpts
Definition: CommandLine.h:233
llvm::cl::parser::OptionInfo::OptionInfo
OptionInfo(StringRef name, DataType v, StringRef helpStr)
Definition: CommandLine.h:815
llvm::cl::opt_storage< DataType, false, false >::getValue
DataType & getValue()
Definition: CommandLine.h:1418
llvm::cl::location
LocationClass< Ty > location(Ty &L)
Definition: CommandLine.h:459
llvm::cl::list_storage< DataType, bool >::operator&
std::vector< DataType > * operator&()
Definition: CommandLine.h:1631
llvm::cl::Option::getOptionHiddenFlag
enum OptionHidden getOptionHiddenFlag() const
Definition: CommandLine.h:296
StringRef.h
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::cl::BOU_FALSE
@ BOU_FALSE
Definition: CommandLine.h:625
llvm::cl::basic_parser_impl::printOptionNoValue
void printOptionNoValue(const Option &O, size_t GlobalWidth) const
Definition: CommandLine.cpp:2113
llvm::cl::parser< boolOrDefault >
Definition: CommandLine.h:960
llvm::cl::bits_storage::addValue
void addValue(const T &V)
Definition: CommandLine.h:1758
llvm::cl::getRegisteredOptions
StringMap< Option * > & getRegisteredOptions(SubCommand &Sub= *TopLevelSubCommand)
Use this to get a StringMap to all registered named options (e.g.
Definition: CommandLine.cpp:2643
llvm::cl::Option::HelpStr
StringRef HelpStr
Definition: CommandLine.h:282
llvm::cl::applicator< StringRef >::opt
static void opt(StringRef Str, Opt &O)
Definition: CommandLine.h:1287
llvm::cl::list::operator=
list & operator=(const list &)=delete
llvm::cl::list_storage< DataType, bool >::const_iterator
typename std::vector< DataType >::const_iterator const_iterator
Definition: CommandLine.h:1578
llvm::cl::parser< bool >::initialize
void initialize()
Definition: CommandLine.h:939
llvm::cl::opt::getParser
ParserClass & getParser()
Definition: CommandLine.h:1502
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::cl::list_storage< DataType, bool >::insert
iterator insert(const_iterator pos, DataType &&value)
Definition: CommandLine.h:1615
llvm::cl::PrintVersionMessage
void PrintVersionMessage()
Utility function for printing version number.
Definition: CommandLine.cpp:2631
llvm::cl::ResetAllOptionOccurrences
void ResetAllOptionOccurrences()
Reset all command line options to a state that looks as if they have never appeared on the command li...
Definition: CommandLine.cpp:1325
llvm::cl::initializer::Init
const Ty & Init
Definition: CommandLine.h:437
llvm::cl::Option::error
bool error(const Twine &Message, StringRef ArgName=StringRef(), raw_ostream &Errs=llvm::errs())
Definition: CommandLine.cpp:1684
llvm::cl::basic_parser_impl::initialize
void initialize()
Definition: CommandLine.h:890
llvm::cl::OptionValueBase::WrapperType
OptionValue< DataType > WrapperType
Definition: CommandLine.h:542
llvm::cl::bits_storage
Definition: CommandLine.h:1738
llvm::cl::list_storage< DataType, bool >::size_type
typename std::vector< DataType >::size_type size_type
Definition: CommandLine.h:1583
ErrorHandling.h
llvm::cl::list_storage< DataType, bool >::erase
iterator erase(iterator pos)
Definition: CommandLine.h:1607
llvm::cl::LocationClass
Definition: CommandLine.h:451
llvm::cl::CommaSeparated
@ CommaSeparated
Definition: CommandLine.h:169
llvm::cl::parser< unsigned long >
Definition: CommandLine.h:1080
llvm::cl::parser::parser
parser(Option &O)
Definition: CommandLine.h:823
ManagedStatic.h
llvm::cl::ValueOptional
@ ValueOptional
Definition: CommandLine.h:136
llvm::cl::multi_val::AdditionalVals
unsigned AdditionalVals
Definition: CommandLine.h:1722
llvm::cl::list_storage< DataType, bool >
Definition: CommandLine.h:1569
llvm::cl::ResetCommandLineParser
void ResetCommandLineParser()
Reset the command line parser back to its initial state.
Definition: CommandLine.cpp:2678
llvm::cl::cb
Definition: CommandLine.h:484
llvm::cl::Option::printOptionInfo
virtual void printOptionInfo(size_t GlobalWidth) const =0
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::cl::SubCommand::SubCommand
SubCommand(StringRef Name, StringRef Description="")
Definition: CommandLine.h:220
llvm::cl::printOptionDiff
void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
Definition: CommandLine.h:1228
llvm::cl::parser< std::string >::parser
parser(Option &O)
Definition: CommandLine.h:1176
llvm::cl::parser< int >
Definition: CommandLine.h:987
llvm::cl::cb::cb
cb(std::function< R(Ty)> CB)
Definition: CommandLine.h:487
llvm::cl::OptionValueCopy::compare
bool compare(const GenericOptionValue &V) const override
Definition: CommandLine.h:588
llvm::cl::list_storage::addValue
void addValue(const T &V)
Definition: CommandLine.h:1554
llvm::cl::basic_parser_impl::basic_parser_impl
basic_parser_impl(Option &)
Definition: CommandLine.h:880
llvm::tgtok::Bits
@ Bits
Definition: TGLexer.h:50
llvm::cl::list_storage< DataType, bool >::clear
void clear()
Definition: CommandLine.h:1598
llvm::PassInfo
PassInfo class - An instance of this class exists for every pass known by the system,...
Definition: PassInfo.h:30
llvm::Optional
Definition: APInt.h:33
llvm::cl::Option::setMiscFlag
void setMiscFlag(enum MiscFlags M)
Definition: CommandLine.h:334
llvm::cl::list_storage< DataType, bool >::push_back
void push_back(DataType &&value)
Definition: CommandLine.h:1590
T
#define T
Definition: Mips16ISelLowering.cpp:341
llvm::cl::GenericOptionValue
Definition: CommandLine.h:522
llvm::cl::opt::opt
opt(const Mods &... Ms)
Definition: CommandLine.h:1511
llvm::cl::bits_storage::bits_storage
bits_storage()=default
llvm::cl::generic_parser_base::getNumOptions
virtual unsigned getNumOptions() const =0
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:449
llvm::cl::list::setCallback
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
Definition: CommandLine.h:1711
llvm::cl::expandResponseFiles
bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv)
A convenience helper which concatenates the options specified by the environment variable EnvVar and ...
Definition: CommandLine.cpp:1260
llvm::cl::desc::apply
void apply(Option &O) const
Definition: CommandLine.h:419
llvm::cl::desc::Desc
StringRef Desc
Definition: CommandLine.h:415
llvm::cl::SubCommand::unregisterSubCommand
void unregisterSubCommand()
Definition: CommandLine.cpp:499
llvm::cl::OptionEnumValue::Value
int Value
Definition: CommandLine.h:668
llvm::errs
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Definition: raw_ostream.cpp:892
llvm::cl::GenericOptionValue::GenericOptionValue
GenericOptionValue()=default
llvm::cl::VersionPrinterTy
std::function< void(raw_ostream &)> VersionPrinterTy
Definition: CommandLine.h:78
STLExtras.h
llvm::cl::cat::apply
void apply(Opt &O) const
Definition: CommandLine.h:470
llvm::cl::generic_parser_base::initialize
void initialize()
Definition: CommandLine.h:767
llvm::cl::parser< boolOrDefault >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:972
llvm::cl::bits::getPosition
unsigned getPosition(unsigned optnum) const
Definition: CommandLine.h:1849
llvm::cl::detail::callback_traits< R(C::*)(Args...) const >::arg_type
std::tuple_element_t< 0, std::tuple< Args... > > arg_type
Definition: CommandLine.h:499
llvm::cl::opt_storage::getValue
const DataType & getValue() const
Definition: CommandLine.h:1369
llvm::cl::ValueRequired
@ ValueRequired
Definition: CommandLine.h:137
llvm::cl::OptionValueCopy::hasValue
bool hasValue() const
Definition: CommandLine.h:574
llvm::cl::Option::printEnumValHelpStr
static void printEnumValHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
Definition: CommandLine.cpp:1749
llvm::cl::list_storage< DataType, bool >::erase
iterator erase(const_iterator pos)
Definition: CommandLine.h:1602
llvm::cl::ReallyHidden
@ ReallyHidden
Definition: CommandLine.h:144
llvm::cl::ValueExpected
ValueExpected
Definition: CommandLine.h:134
llvm::cl::initializer
Definition: CommandLine.h:436
llvm::cl::list_storage< DataType, bool >::end
iterator end()
Definition: CommandLine.h:1576
llvm::cl::OptionValue< cl::boolOrDefault >::operator=
OptionValue< cl::boolOrDefault > & operator=(const cl::boolOrDefault &V)
Definition: CommandLine.h:635
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:193
llvm::cl::generic_parser_base::printOptionInfo
virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const
Definition: CommandLine.cpp:1984
llvm::cl::Option::setValueExpectedFlag
void setValueExpectedFlag(enum ValueExpected Val)
Definition: CommandLine.h:331
llvm::cl::Option::hasArgStr
bool hasArgStr() const
Definition: CommandLine.h:309
llvm::cl::bits_storage::getBits
unsigned getBits()
Definition: CommandLine.h:1764
llvm::cl::parser< double >
Definition: CommandLine.h:1128
llvm::cl::generic_parser_base::GenericOptionInfo::GenericOptionInfo
GenericOptionInfo(StringRef name, StringRef helpStr)
Definition: CommandLine.h:719
llvm::cl::parser::getOptionValue
const GenericOptionValue & getOptionValue(unsigned N) const override
Definition: CommandLine.h:835
llvm::cl::applicator< NumOccurrencesFlag >
Definition: CommandLine.h:1292
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
llvm::cl::SubCommand::SubCommand
SubCommand()=default
llvm::cl::OptionValue::operator=
OptionValue< DataType > & operator=(const DT &V)
Definition: CommandLine.h:618
llvm::cl::sub::Sub
SubCommand & Sub
Definition: CommandLine.h:475
llvm::cl::OptionValueBase::setValue
void setValue(const DT &)
Definition: CommandLine.h:549
llvm::cl::basic_parser
Definition: CommandLine.h:918
llvm::cl::GenericOptionValue::~GenericOptionValue
~GenericOptionValue()=default
llvm::cl::apply
void apply(Opt *O, const Mod &M, const Mods &... Ms)
Definition: CommandLine.h:1320
llvm::cl::OptionEnumValue::Description
StringRef Description
Definition: CommandLine.h:669
llvm::AArch64CC::VC
@ VC
Definition: AArch64BaseInfo.h:262
llvm::PPCISD::SC
@ SC
CHAIN = SC CHAIN, Imm128 - System call.
Definition: PPCISelLowering.h:410
llvm::cl::OptionValueCopy::~OptionValueCopy
~OptionValueCopy()=default
llvm::cl::generic_parser_base::findOption
unsigned findOption(StringRef Name)
Definition: CommandLine.cpp:1937
llvm::cl::parser::removeLiteralOption
void removeLiteralOption(StringRef Name)
removeLiteralOption - Remove the specified option.
Definition: CommandLine.h:868
llvm::cl::list_storage< DataType, bool >::end
const_iterator end() const
Definition: CommandLine.h:1581
llvm::cl::parser< double >::parser
parser(Option &O)
Definition: CommandLine.h:1130
llvm::cl::aliasopt
Definition: CommandLine.h:1933
llvm::cl::OptionValueCopy::compare
bool compare(const DataType &V) const
Definition: CommandLine.h:586
llvm::cl::OptionValueCopy::operator=
OptionValueCopy & operator=(const OptionValueCopy &)=default
llvm::cl::Option::getExtraOptionNames
virtual void getExtraOptionNames(SmallVectorImpl< StringRef > &)
Definition: CommandLine.h:391
llvm::cl::parser< unsigned >::parser
parser(Option &O)
Definition: CommandLine.h:1058
llvm::cl::Option::reset
void reset()
Definition: CommandLine.cpp:474
llvm::cl::OptionValueBase::compare
bool compare(const DataType &) const
Definition: CommandLine.h:551
llvm::cl::bits::operator=
bits & operator=(const bits &)=delete
llvm::cl::OptionDiffPrinter
Definition: CommandLine.h:1236
llvm::cl::opt_storage< DataType, false, false >::opt_storage
opt_storage()
Definition: CommandLine.h:1411
llvm::cl::applicator< char[n]>
Definition: CommandLine.h:1276
llvm::cl::parser< bool >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:946
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::cl::SubCommand::ConsumeAfterOpt
Option * ConsumeAfterOpt
Definition: CommandLine.h:237
llvm::cl::sub::sub
sub(SubCommand &S)
Definition: CommandLine.h:477
llvm::cl::Option::getMiscFlags
unsigned getMiscFlags() const
Definition: CommandLine.h:304
llvm::cl::Required
@ Required
Definition: CommandLine.h:121
Twine.h
llvm::cl::PrintOptionValues
void PrintOptionValues()
Definition: CommandLine.cpp:2600
llvm::cl::Option::setFormattingFlag
void setFormattingFlag(enum FormattingFlags V)
Definition: CommandLine.h:333
llvm::cl::PositionalEatsArgs
@ PositionalEatsArgs
Definition: CommandLine.h:170
llvm::cl::Option::getFormattingFlag
enum FormattingFlags getFormattingFlag() const
Definition: CommandLine.h:300
llvm::cl::parser< char >::parse
bool parse(Option &, StringRef, StringRef Arg, char &Value)
Definition: CommandLine.h:1205
llvm::cl::NotHidden
@ NotHidden
Definition: CommandLine.h:142
llvm::cl::NumOccurrencesFlag
NumOccurrencesFlag
Definition: CommandLine.h:118
llvm::cl::ParseCommandLineOptions
bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false)
Definition: CommandLine.cpp:1297
llvm::cl::detail::callback_traits
Definition: CommandLine.h:494
llvm::cl::opt::operator=
opt & operator=(const opt &)=delete
llvm::ManagedStatic
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83
llvm::cl::Option::isConsumeAfter
bool isConsumeAfter() const
Definition: CommandLine.h:314
llvm::cl::parser< boolOrDefault >::parser
parser(Option &O)
Definition: CommandLine.h:962
llvm::cl::generic_parser_base::getOption
virtual StringRef getOption(unsigned N) const =0
false
Definition: StackSlotColoring.cpp:142
llvm::cl::Positional
@ Positional
Definition: CommandLine.h:163
llvm::cl::ConsumeAfter
@ ConsumeAfter
Definition: CommandLine.h:131
llvm::cl::aliasopt::Opt
Option & Opt
Definition: CommandLine.h:1934
llvm::cl::parser< float >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1159
llvm::cl::OptionValueBase< DataType, false >::WrapperType
DataType WrapperType
Definition: CommandLine.h:600
llvm::cl::bits::Callback
std::function< void(const typename ParserClass::parser_data_type &)> Callback
Definition: CommandLine.h:1866
llvm::cl::generic_parser_base::getExtraOptionNames
void getExtraOptionNames(SmallVectorImpl< StringRef > &OptionNames)
Definition: CommandLine.h:769
llvm::cl::TokenizeWindowsCommandLine
void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a Windows command line which may contain quotes and escaped quotes.
Definition: CommandLine.cpp:1016
llvm::cl::SubCommand::registerSubCommand
void registerSubCommand()
Definition: CommandLine.cpp:495
llvm::cl::parser< long >::parser
parser(Option &O)
Definition: CommandLine.h:1012
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::cl::generic_parser_base::GenericOptionInfo
Definition: CommandLine.h:717
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::cl::parser
Definition: CommandLine.h:811
llvm::cl::Option::getNumAdditionalVals
unsigned getNumAdditionalVals() const
Definition: CommandLine.h:306
llvm::cl::Option::alias
friend class alias
Definition: CommandLine.h:250
llvm::cl::Option::getNumOccurrences
int getNumOccurrences() const
Definition: CommandLine.h:404
llvm::cl::applicator< FormattingFlags >
Definition: CommandLine.h:1306
llvm::cl::list_storage< DataType, bool >::addValue
void addValue(const T &V)
Definition: CommandLine.h:1634
llvm::cl::HideUnrelatedOptions
void HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub= *TopLevelSubCommand)
Mark all options not part of this category as cl::ReallyHidden.
Definition: CommandLine.cpp:2656
llvm::cl::list_storage< DataType, bool >::begin
const_iterator begin() const
Definition: CommandLine.h:1580
SmallPtrSet.h
llvm::cl::OptionValueCopy
Definition: CommandLine.h:562
llvm::cl::OneOrMore
@ OneOrMore
Definition: CommandLine.h:122
StringMap.h
llvm::cl::generic_parser_base::GenericOptionInfo::Name
StringRef Name
Definition: CommandLine.h:721
c
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int c
Definition: README.txt:418
llvm::cl::multi_val::multi_val
multi_val(unsigned N)
Definition: CommandLine.h:1723
llvm::cl::AllSubCommands
ManagedStatic< SubCommand > AllSubCommands
Definition: CommandLine.cpp:493
llvm::cl::Option::setValueStr
void setValueStr(StringRef S)
Definition: CommandLine.h:329
llvm::cl::SubCommand::getDescription
StringRef getDescription() const
Definition: CommandLine.h:231
llvm::None
const NoneType None
Definition: None.h:23
llvm::cl::applicator< OptionHidden >
Definition: CommandLine.h:1302
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::cl::Option::addArgument
void addArgument()
Definition: CommandLine.cpp:447
llvm::cl::parser< unsigned long long >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1113
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::cl::bits_storage< DataType, bool >::getBits
unsigned getBits()
Definition: CommandLine.h:1787
llvm::cl::list_storage::setLocation
bool setLocation(Option &O, StorageClass &L)
Definition: CommandLine.h:1547
llvm::cl::list::list
list(const Mods &... Ms)
Definition: CommandLine.h:1705
llvm::cl::generic_parser_base::Owner
Option & Owner
Definition: CommandLine.h:802
llvm::cl::opt::opt
opt(const opt &)=delete
llvm::cl::OptionValue< cl::boolOrDefault >
Definition: CommandLine.h:627
llvm::cl::ZeroOrMore
@ ZeroOrMore
Definition: CommandLine.h:120
llvm::cl::Option::ArgStr
StringRef ArgStr
Definition: CommandLine.h:281
llvm::cl::ValuesClass::apply
void apply(Opt &O) const
Definition: CommandLine.h:690
llvm::Value::Value
Value(Type *Ty, unsigned scid)
Definition: Value.cpp:53
llvm::XCOFF::StorageClass
StorageClass
Definition: XCOFF.h:113
llvm::cl::Option::setDescription
void setDescription(StringRef S)
Definition: CommandLine.h:328
llvm::cl::opt
Definition: CommandLine.h:1434
llvm::cl::opt_storage::setLocation
bool setLocation(Option &O, DataType &L)
Definition: CommandLine.h:1350
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:192
llvm::cl::Option
Definition: CommandLine.h:249
llvm::cl::list_storage< DataType, bool >::operator[]
reference operator[](size_type pos)
Definition: CommandLine.h:1595
llvm::cl::OptionValue::OptionValue
OptionValue()=default
llvm::cl::OptionValueBase::compare
bool compare(const GenericOptionValue &) const override
Definition: CommandLine.h:553
llvm::cl::OptionCategory::getDescription
StringRef getDescription() const
Definition: CommandLine.h:201
llvm::cl::generic_parser_base::printOptionDiff
void printOptionDiff(const Option &O, const AnyOptionValue &V, const AnyOptionValue &Default, size_t GlobalWidth) const
Definition: CommandLine.h:761
llvm::cl::list::getParser
ParserClass & getParser()
Definition: CommandLine.h:1695
llvm::cl::applicator::opt
static void opt(const Mod &M, Opt &O)
Definition: CommandLine.h:1272
llvm::cl::SubCommand::SinkOpts
SmallVector< Option *, 4 > SinkOpts
Definition: CommandLine.h:234
llvm::cl::values
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:699
llvm::cl::BOU_UNSET
@ BOU_UNSET
Definition: CommandLine.h:625
llvm::cl::parser< unsigned long >::parser
parser(Option &O)
Definition: CommandLine.h:1082
llvm::cl::OptionDiffPrinter< DT, DT >
Definition: CommandLine.h:1245
llvm::cl::generic_parser_base::GenericOptionInfo::HelpStr
StringRef HelpStr
Definition: CommandLine.h:722
llvm::cl::extrahelp
Definition: CommandLine.h:1945
llvm::cl::cat::cat
cat(OptionCategory &c)
Definition: CommandLine.h:468
llvm::cl::Option::getValueExpectedFlag
enum ValueExpected getValueExpectedFlag() const
Definition: CommandLine.h:292
llvm::cl::parser< double >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1136
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::cl::opt::setInitialValue
void setInitialValue(const DataType &V)
Definition: CommandLine.h:1500
llvm::cl::parser< std::string >::parse
bool parse(Option &, StringRef, StringRef Arg, std::string &Value)
Definition: CommandLine.h:1179
llvm::cl::basic_parser_impl
Definition: CommandLine.h:878
llvm::cl::OptionValue< std::string >::OptionValue
OptionValue(const std::string &V)
Definition: CommandLine.h:650
llvm::cl::parser< char >
Definition: CommandLine.h:1200
llvm::cl::list_storage< DataType, bool >::empty
bool empty() const
Definition: CommandLine.h:1587
llvm::cl::opt_storage< DataType, false, true >::getValue
const DataType & getValue() const
Definition: CommandLine.h:1395
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::cl::OptionDiffPrinter::print
void print(const Option &O, const parser< ParserDT > &P, const ValDT &, const OptionValue< ValDT > &, size_t GlobalWidth)
Definition: CommandLine.h:1237
llvm::cl::Grouping
@ Grouping
Definition: CommandLine.h:177
llvm::cl::OptionValue< std::string >::operator=
OptionValue< std::string > & operator=(const std::string &V)
Definition: CommandLine.h:652
llvm::cl::list::Callback
std::function< void(const typename ParserClass::parser_data_type &)> Callback
Definition: CommandLine.h:1716
llvm::cl::list_storage
Definition: CommandLine.h:1539
llvm::cl::parser< long long >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1041
llvm::cl::Option::setNumAdditionalVals
void setNumAdditionalVals(unsigned n)
Definition: CommandLine.h:348
llvm::cl::ValuesClass
Definition: CommandLine.h:680
llvm::cl::parser< unsigned >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1064
llvm::cl::SetVersionPrinter
void SetVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// SetVersionPrinter - Overr...
Definition: CommandLine.cpp:2635
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
llvm::cl::SubCommand
Definition: CommandLine.h:210
llvm::cl::parser< long long >::parser
parser(Option &O)
Definition: CommandLine.h:1035
ArrayRef.h
llvm::cl::applicator< ValueExpected >
Definition: CommandLine.h:1298
llvm::cl::ProvidePositionalOption
bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i)
Parses Arg into the option handler Handler.
Definition: CommandLine.cpp:709
llvm::cl::list_storage< DataType, bool >::begin
iterator begin()
Definition: CommandLine.h:1575
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::cl::parser::addLiteralOption
void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr)
addLiteralOption - Add an entry to the mapping table.
Definition: CommandLine.h:859
llvm::cl::basic_parser_impl::~basic_parser_impl
virtual ~basic_parser_impl()
Definition: CommandLine.h:882
llvm::cl::OptionValueBase
Definition: CommandLine.h:540
llvm::cl::cb::CB
std::function< R(Ty)> CB
Definition: CommandLine.h:485
llvm::cl::bits_storage::isSet
bool isSet(const T &V)
Definition: CommandLine.h:1766
llvm::cl::ValueDisallowed
@ ValueDisallowed
Definition: CommandLine.h:138
llvm::cl::parser< int >::parser
parser(Option &O)
Definition: CommandLine.h:989
llvm::ScaledNumbers::compare
int compare(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)
Compare two scaled numbers.
Definition: ScaledNumber.h:251
llvm::cl::opt_storage< DataType, false, false >::Value
DataType Value
Definition: CommandLine.h:1406
llvm::cl::OptionEnumValue
Definition: CommandLine.h:666
llvm::cl::tokenizeConfigFile
void tokenizeConfigFile(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes content of configuration file.
Definition: CommandLine.cpp:1036
llvm::cl::LocationClass::LocationClass
LocationClass(Ty &L)
Definition: CommandLine.h:454
llvm::cl::opt_storage::opt_storage
opt_storage()=default
llvm::cl::Option::setDefault
virtual void setDefault()=0
iterator_range.h
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::cl::list::getPosition
unsigned getPosition(unsigned optnum) const
Definition: CommandLine.h:1697
llvm::cl::Option::setArgStr
void setArgStr(StringRef S)
Definition: CommandLine.cpp:454
llvm::cl::PrintHelpMessage
void PrintHelpMessage(bool Hidden=false, bool Categorized=false)
This function just prints the help message, exactly the same way as if the -help or -help-hidden opti...
Definition: CommandLine.cpp:2619
llvm::cl::OptionValueBase::getValue
const DataType & getValue() const
Definition: CommandLine.h:546
llvm::cl::bits
Definition: CommandLine.h:1797
llvm::cl::applicator< MiscFlags >
Definition: CommandLine.h:1310
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::cl::generic_parser_base::printGenericOptionDiff
void printGenericOptionDiff(const Option &O, const GenericOptionValue &V, const GenericOptionValue &Default, size_t GlobalWidth) const
Definition: CommandLine.cpp:2037
llvm::cl::applicator< FormattingFlags >::opt
static void opt(FormattingFlags FF, Option &O)
Definition: CommandLine.h:1307
llvm::cl::OptionValueBase::~OptionValueBase
~OptionValueBase()=default
llvm::cl::boolOrDefault
boolOrDefault
Definition: CommandLine.h:625
llvm::cl::parser< float >
Definition: CommandLine.h:1151
llvm::cl::bits::bits
bits(const Mods &... Ms)
Definition: CommandLine.h:1855
llvm::cl::basic_parser_impl::getValueName
virtual StringRef getValueName() const
Definition: CommandLine.h:905
llvm::cl::bits_storage::setLocation
bool setLocation(Option &O, unsigned &L)
Definition: CommandLine.h:1751
llvm::cl::parser::getOption
StringRef getOption(unsigned N) const override
Definition: CommandLine.h:829
llvm::cl::FormattingFlags
FormattingFlags
Definition: CommandLine.h:161
llvm::StringSaver
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Definition: StringSaver.h:21
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1528
llvm::cl::TokenizeWindowsCommandLineNoCopy
void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver, SmallVectorImpl< StringRef > &NewArgv)
Tokenizes a Windows command line while attempting to avoid copies.
Definition: CommandLine.cpp:1028
llvm::cl::list_storage< DataType, bool >::insert
iterator insert(iterator pos, const DataType &value)
Definition: CommandLine.h:1619
llvm::cl::opt::setCallback
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
Definition: CommandLine.h:1517
llvm::Sched::Source
@ Source
Definition: TargetLowering.h:100
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::cl::basic_parser< bool >::parser_data_type
bool parser_data_type
Definition: CommandLine.h:920
None.h
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1554
llvm::cl::parser< bool >::parser
parser(Option &O)
Definition: CommandLine.h:934
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::cl::list_storage< DataType, bool >::insert
iterator insert(iterator pos, DataType &&value)
Definition: CommandLine.h:1622
cl
http eax xorl edx cl sete al setne dl sall cl
Definition: README.txt:25
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::cl::list_storage< DataType, bool >::erase
iterator erase(const_iterator first, const_iterator last)
Definition: CommandLine.h:1603
llvm::cl::Sink
@ Sink
Definition: CommandLine.h:171
llvm::cl::alias
Definition: CommandLine.h:1874
llvm::cl::Option::~Option
virtual ~Option()=default
llvm::cl::TokenizerCallback
void(*)(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) TokenizerCallback
String tokenization function type.
Definition: CommandLine.h:2061
parse
static llvm::Error parse(DataExtractor &Data, uint64_t BaseAddr, LineEntryCallback const &Callback)
Definition: LineTable.cpp:54
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::cl::applicator< const char[n]>::opt
static void opt(StringRef Str, Opt &O)
Definition: CommandLine.h:1282
llvm::cl::TokenizeGNUCommandLine
void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a command line that can contain escapes and quotes.
Definition: CommandLine.cpp:823
llvm::cl::parser::OptionInfo::V
OptionValue< DataType > V
Definition: CommandLine.h:818
llvm::cl::OptionCategory::OptionCategory
OptionCategory(StringRef const Name, StringRef const Description="")
Definition: CommandLine.h:194
llvm::cl::parser< unsigned long >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1088
llvm::Init
Definition: Record.h:271
llvm::cl::Option::getOptionWidth
virtual size_t getOptionWidth() const =0
llvm::cl::value_desc::value_desc
value_desc(StringRef Str)
Definition: CommandLine.h:427
llvm::cl::opt_storage< DataType, false, true >::getValue
DataType & getValue()
Definition: CommandLine.h:1394
llvm::cl::LocationClass::Loc
Ty & Loc
Definition: CommandLine.h:452
llvm::cl::generic_parser_base::getDescription
virtual StringRef getDescription(unsigned N) const =0
llvm::cl::OptionValue< cl::boolOrDefault >::OptionValue
OptionValue(const cl::boolOrDefault &V)
Definition: CommandLine.h:633
llvm::cl::Option::Subs
SmallPtrSet< SubCommand *, 1 > Subs
Definition: CommandLine.h:286
llvm::cl::opt_storage< DataType, false, true >::setValue
void setValue(const T &V, bool initial=false)
Definition: CommandLine.h:1388
llvm::cl::Option::printOptionValue
virtual void printOptionValue(size_t GlobalWidth, bool Force) const =0
llvm::cl::OptionValueCopy::setValue
void setValue(const DataType &V)
Definition: CommandLine.h:581
llvm::cl::AlwaysPrefix
@ AlwaysPrefix
Definition: CommandLine.h:165
llvm::cl::bits_storage< DataType, bool >::isSet
bool isSet(const T &V)
Definition: CommandLine.h:1789
llvm::cl::initializer::initializer
initializer(const Ty &Val)
Definition: CommandLine.h:438
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78
llvm::cl::opt_storage< DataType, false, true >::Default
OptionValue< DataType > Default
Definition: CommandLine.h:1386
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::cl::opt_storage< DataType, false, false >::getDefault
const OptionValue< DataType > & getDefault() const
Definition: CommandLine.h:1421
llvm::cl::bits::getParser
ParserClass & getParser()
Definition: CommandLine.h:1847
llvm::cl::Option::isInAllSubCommands
bool isInAllSubCommands() const
Definition: CommandLine.h:318
llvm::vfs::FileSystem
The virtual file system interface.
Definition: VirtualFileSystem.h:245
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::cl::AddLiteralOption
void AddLiteralOption(Option &O, StringRef Name)
Adds a new option for parsing and provides the option it refers to.
Definition: CommandLine.cpp:439
std
Definition: BitVector.h:838
uint16_t
llvm::cl::bits::setCallback
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
Definition: CommandLine.h:1861
llvm::cl::Option::isPositional
bool isPositional() const
Definition: CommandLine.h:310
llvm::cl::generic_parser_base::~generic_parser_base
virtual ~generic_parser_base()=default
llvm::cl::basic_parser_impl::getOptionWidth
size_t getOptionWidth(const Option &O) const
Definition: CommandLine.cpp:1776
llvm::cl::alias::setAliasFor
void setAliasFor(Option &O)
Definition: CommandLine.h:1918
llvm::cl::OptionCategory::getName
StringRef getName() const
Definition: CommandLine.h:200
llvm::cl::GenericOptionValue::operator=
GenericOptionValue & operator=(const GenericOptionValue &)=default
llvm::cl::parser::Values
SmallVector< OptionInfo, 8 > Values
Definition: CommandLine.h:820
llvm::cl::list_storage< DataType, bool >::size
size_type size() const
Definition: CommandLine.h:1585
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::cl::detail::callback_traits< R(C::*)(Args...) const >::result_type
R result_type
Definition: CommandLine.h:498
llvm::cl::multi_val::apply
void apply(list< D, S, P > &L) const
Definition: CommandLine.h:1726
llvm::cl::list_storage::clear
void clear()
Definition: CommandLine.h:1545
llvm::cl::opt_storage
Definition: CommandLine.h:1337
llvm::cl::NormalFormatting
@ NormalFormatting
Definition: CommandLine.h:162
llvm::cl::Option::printHelpStr
static void printHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
Definition: CommandLine.cpp:1737
llvm::cl::applicator< char[n]>::opt
static void opt(StringRef Str, Opt &O)
Definition: CommandLine.h:1277
llvm::cl::value_desc
Definition: CommandLine.h:424
llvm::cl::parser< unsigned >
Definition: CommandLine.h:1056
llvm::cl::Option::setNumOccurrencesFlag
void setNumOccurrencesFlag(enum NumOccurrencesFlag Val)
Definition: CommandLine.h:330
llvm::cl::list::setNumAdditionalVals
void setNumAdditionalVals(unsigned n)
Definition: CommandLine.h:1702
llvm::cl::basic_parser_impl::printOptionName
void printOptionName(const Option &O, size_t GlobalWidth) const
Definition: CommandLine.cpp:1809
llvm::cl::OptionValueCopy::getValue
const DataType & getValue() const
Definition: CommandLine.h:576
llvm::cl::opt_storage< DataType, false, false >::getValue
DataType getValue() const
Definition: CommandLine.h:1419
llvm::cl::multi_val
Definition: CommandLine.h:1721
llvm::cl::list_storage< DataType, bool >::iterator
typename std::vector< DataType >::iterator iterator
Definition: CommandLine.h:1573
llvm::cl::Option::addSubCommand
void addSubCommand(SubCommand &S)
Definition: CommandLine.h:337
llvm::cl::Option::setPosition
void setPosition(unsigned pos)
Definition: CommandLine.h:335
llvm::cl::aliasopt::apply
void apply(alias &A) const
Definition: CommandLine.h:1938
llvm::cl::BOU_TRUE
@ BOU_TRUE
Definition: CommandLine.h:625
llvm::cl::parser< long long >
Definition: CommandLine.h:1033
llvm::cl::applicator< OptionHidden >::opt
static void opt(OptionHidden OH, Option &O)
Definition: CommandLine.h:1303
llvm::cl::parser< long >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1018
llvm::cl::OptionValueCopy::OptionValueCopy
OptionValueCopy()=default
llvm::cl::initializer::apply
void apply(Opt &O) const
Definition: CommandLine.h:440
SmallVector.h
llvm::cl::parser< std::string >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1185
llvm::cl::OptionValue< std::string >
Definition: CommandLine.h:645
llvm::cl::parser< int >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:995
llvm::cl::Option::getNumOccurrencesFlag
enum NumOccurrencesFlag getNumOccurrencesFlag() const
Definition: CommandLine.h:288
llvm::cl::list_storage< DataType, bool >::front
const_reference front() const
Definition: CommandLine.h:1627
N
#define N
llvm::cl::opt_storage::getValue
DataType & getValue()
Definition: CommandLine.h:1365
llvm::cl::OptionValueBase::hasValue
bool hasValue() const
Definition: CommandLine.h:544
llvm::cl::cat
Definition: CommandLine.h:465
llvm::cl::generic_parser_base::generic_parser_base
generic_parser_base(Option &O)
Definition: CommandLine.h:726
llvm::cl::generic_parser_base::getOptionWidth
virtual size_t getOptionWidth(const Option &O) const
Definition: CommandLine.cpp:1961
llvm::cl::Option::ValueStr
StringRef ValueStr
Definition: CommandLine.h:283
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::cl::TopLevelSubCommand
ManagedStatic< SubCommand > TopLevelSubCommand
Definition: CommandLine.cpp:490
llvm::cl::applicator< const char[n]>
Definition: CommandLine.h:1281
llvm::cl::OptionEnumValue::Name
StringRef Name
Definition: CommandLine.h:667
llvm::cl::list_storage< DataType, bool >::insert
iterator insert(const_iterator pos, const DataType &value)
Definition: CommandLine.h:1612
llvm::SmallVectorImpl< StringRef >
llvm::cl::applicator< ValueExpected >::opt
static void opt(ValueExpected VE, Option &O)
Definition: CommandLine.h:1299
llvm::cl::parser< std::string >
Definition: CommandLine.h:1174
llvm::cl::list_storage< DataType, bool >::operator&
const std::vector< DataType > * operator&() const
Definition: CommandLine.h:1632
llvm::cl::parser< char >::parser
parser(Option &O)
Definition: CommandLine.h:1202
llvm::cl::parser::OptionInfo
Definition: CommandLine.h:813
llvm::cl::Option::addCategory
void addCategory(OptionCategory &C)
Definition: CommandLine.cpp:463
llvm::cl::parser< float >::parser
parser(Option &O)
Definition: CommandLine.h:1153
llvm::cl::parser< bool >
Definition: CommandLine.h:932
llvm::cl::callback
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > callback(F CB)
Definition: CommandLine.h:512
llvm::cl::Option::Option
Option(enum NumOccurrencesFlag OccurrencesFlag, enum OptionHidden Hidden)
Definition: CommandLine.h:340
llvm::cl::Option::isSink
bool isSink() const
Definition: CommandLine.h:311
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::cl::GenericOptionValue::compare
virtual bool compare(const GenericOptionValue &V) const =0
llvm::cl::desc
Definition: CommandLine.h:414
llvm::cl::generic_parser_base::getValueExpectedFlagDefault
enum ValueExpected getValueExpectedFlagDefault() const
Definition: CommandLine.h:778
llvm::cl::Option::isDefaultOption
bool isDefaultOption() const
Definition: CommandLine.h:312
Mod
Module * Mod
Definition: PassBuilderBindings.cpp:54
llvm::cl::applicator< StringRef >
Definition: CommandLine.h:1286
llvm::cl::list_storage< DataType, bool >::operator[]
const_reference operator[](size_type pos) const
Definition: CommandLine.h:1596
llvm::cl::extrahelp::morehelp
StringRef morehelp
Definition: CommandLine.h:1946
llvm::cl::ValuesClass::ValuesClass
ValuesClass(std::initializer_list< OptionEnumValue > Options)
Definition: CommandLine.h:687
raw_ostream.h
llvm::cl::applicator
Definition: CommandLine.h:1271
n
The same transformation can work with an even modulo with the addition of a and shrink the compare RHS by the same amount Unless the target supports that transformation probably isn t worthwhile The transformation can also easily be made to work with non zero equality for n
Definition: README.txt:685
llvm::cl::bits_storage< DataType, bool >::addValue
void addValue(const T &V)
Definition: CommandLine.h:1785
llvm::cl::LocationClass::apply
void apply(Opt &O) const
Definition: CommandLine.h:456
llvm::cl::applicator< NumOccurrencesFlag >::opt
static void opt(NumOccurrencesFlag N, Option &O)
Definition: CommandLine.h:1293
llvm::cl::OptionValue
Definition: CommandLine.h:535
llvm::cl::Option::removeArgument
void removeArgument()
Unregisters this option from the CommandLine system.
Definition: CommandLine.cpp:452
llvm::cl::sub
Definition: CommandLine.h:474
llvm::cl::basic_parser::basic_parser
basic_parser(Option &O)
Definition: CommandLine.h:923
llvm::cl::getGeneralCategory
OptionCategory & getGeneralCategory()
Definition: CommandLine.cpp:2555
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1815
llvm::cl::OptionValue::OptionValue
OptionValue(const DataType &V)
Definition: CommandLine.h:615
llvm::cl::alias::operator=
alias & operator=(const alias &)=delete
llvm::cl::list_storage< DataType, bool >::push_back
void push_back(const DataType &value)
Definition: CommandLine.h:1589
llvm::cl::opt_storage::getDefault
const OptionValue< DataType > & getDefault() const
Definition: CommandLine.h:1376
llvm::cl::basic_parser_impl::printOptionInfo
void printOptionInfo(const Option &O, size_t GlobalWidth) const
Definition: CommandLine.cpp:1792
llvm::cl::opt::Callback
std::function< void(const typename ParserClass::parser_data_type &)> Callback
Definition: CommandLine.h:1522
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::cl::bits::bits
bits(const bits &)=delete
llvm::cl::parser< long >
Definition: CommandLine.h:1010
llvm::cl::sub::apply
void apply(Opt &O) const
Definition: CommandLine.h:479
llvm::cl::Option::error
bool error(const Twine &Message, raw_ostream &Errs)
Definition: CommandLine.h:400
llvm::cl::list_storage< DataType, bool >::const_reference
typename std::vector< DataType >::const_reference const_reference
Definition: CommandLine.h:1593
llvm::cl::getRegisteredSubcommands
iterator_range< typename SmallPtrSet< SubCommand *, 4 >::iterator > getRegisteredSubcommands()
Use this to get all registered SubCommands from the provided parser.
Definition: CommandLine.cpp:2652
llvm::cl::applicator< MiscFlags >::opt
static void opt(MiscFlags MF, Option &O)
Definition: CommandLine.h:1311
llvm::cl::SubCommand::getName
StringRef getName() const
Definition: CommandLine.h:230
llvm::cl::opt_storage< DataType, false, false >::setValue
void setValue(const T &V, bool initial=false)
Definition: CommandLine.h:1413
llvm::cl::opt_storage< DataType, false, false >::Default
OptionValue< DataType > Default
Definition: CommandLine.h:1407
SpecialSubKind::string
@ string
llvm::cl::opt_storage::setValue
void setValue(const T &V, bool initial=false)
Definition: CommandLine.h:1358
llvm::cl::list_storage< DataType, bool >::front
reference front()
Definition: CommandLine.h:1626
llvm::cl::parser< char >::getValueName
StringRef getValueName() const override
Definition: CommandLine.h:1211
llvm::cl::OptionCategory
Definition: CommandLine.h:186
llvm::cl::Option::setHiddenFlag
void setHiddenFlag(enum OptionHidden Val)
Definition: CommandLine.h:332
llvm::cl::list
Definition: CommandLine.h:1642