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