LLVM  4.0.0
ArgList.h
Go to the documentation of this file.
1 //===--- ArgList.h - Argument List Management -------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_OPTION_ARGLIST_H
11 #define LLVM_OPTION_ARGLIST_H
12 
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/ADT/SmallString.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/ADT/Twine.h"
17 #include "llvm/Option/Arg.h"
19 #include "llvm/Option/Option.h"
20 #include <list>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 namespace llvm {
26 namespace opt {
27 class ArgList;
28 class Option;
29 
30 /// arg_iterator - Iterates through arguments stored inside an ArgList.
31 class arg_iterator {
32  /// The current argument.
34 
35  /// The argument list we are iterating over.
36  const ArgList &Args;
37 
38  /// Optional filters on the arguments which will be match. Most clients
39  /// should never want to iterate over arguments without filters, so we won't
40  /// bother to factor this into two separate iterator implementations.
41  //
42  // FIXME: Make efficient; the idea is to provide efficient iteration over
43  // all arguments which match a particular id and then just provide an
44  // iterator combinator which takes multiple iterators which can be
45  // efficiently compared and returns them in order.
46  OptSpecifier Id0, Id1, Id2;
47 
48  void SkipToNextArg();
49 
50 public:
51  typedef Arg * const * value_type;
52  typedef Arg * const & reference;
53  typedef Arg * const * pointer;
54  typedef std::forward_iterator_tag iterator_category;
55  typedef std::ptrdiff_t difference_type;
56 
58  OptSpecifier Id0 = 0U, OptSpecifier Id1 = 0U,
59  OptSpecifier Id2 = 0U)
60  : Current(it), Args(Args), Id0(Id0), Id1(Id1), Id2(Id2) {
61  SkipToNextArg();
62  }
63 
64  operator const Arg*() { return *Current; }
65  reference operator*() const { return *Current; }
66  pointer operator->() const { return Current; }
67 
69  ++Current;
70  SkipToNextArg();
71  return *this;
72  }
73 
75  arg_iterator tmp(*this);
76  ++(*this);
77  return tmp;
78  }
79 
80  friend bool operator==(arg_iterator LHS, arg_iterator RHS) {
81  return LHS.Current == RHS.Current;
82  }
83  friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {
84  return !(LHS == RHS);
85  }
86 };
87 
88 /// ArgList - Ordered collection of driver arguments.
89 ///
90 /// The ArgList class manages a list of Arg instances as well as
91 /// auxiliary data and convenience methods to allow Tools to quickly
92 /// check for the presence of Arg instances for a particular Option
93 /// and to iterate over groups of arguments.
94 class ArgList {
95 public:
101 
102 private:
103  /// The internal list of arguments.
104  arglist_type Args;
105 
106 protected:
107  // Make the default special members protected so they won't be used to slice
108  // derived objects, but can still be used by derived objects to implement
109  // their own special members.
110  ArgList() = default;
111  // Explicit move operations to ensure the container is cleared post-move
112  // otherwise it could lead to a double-delete in the case of moving of an
113  // InputArgList which deletes the contents of the container. If we could fix
114  // up the ownership here (delegate storage/ownership to the derived class so
115  // it can be a container of unique_ptr) this would be simpler.
116  ArgList(ArgList &&RHS) : Args(std::move(RHS.Args)) { RHS.Args.clear(); }
118  Args = std::move(RHS.Args);
119  RHS.Args.clear();
120  return *this;
121  }
122  // Protect the dtor to ensure this type is never destroyed polymorphically.
123  ~ArgList() = default;
124 
125 public:
126 
127  /// @name Arg Access
128  /// @{
129 
130  /// append - Append \p A to the arg list.
131  void append(Arg *A);
132 
133  arglist_type &getArgs() { return Args; }
134  const arglist_type &getArgs() const { return Args; }
135 
136  unsigned size() const { return Args.size(); }
137 
138  /// @}
139  /// @name Arg Iteration
140  /// @{
141 
142  iterator begin() { return Args.begin(); }
143  iterator end() { return Args.end(); }
144 
145  reverse_iterator rbegin() { return Args.rbegin(); }
146  reverse_iterator rend() { return Args.rend(); }
147 
148  const_iterator begin() const { return Args.begin(); }
149  const_iterator end() const { return Args.end(); }
150 
151  const_reverse_iterator rbegin() const { return Args.rbegin(); }
152  const_reverse_iterator rend() const { return Args.rend(); }
153 
155  OptSpecifier Id2 = 0U) const {
156  return arg_iterator(Args.begin(), *this, Id0, Id1, Id2);
157  }
159  return arg_iterator(Args.end(), *this);
160  }
161 
163  OptSpecifier Id1 = 0U,
164  OptSpecifier Id2 = 0U) const {
165  return make_range(filtered_begin(Id0, Id1, Id2), filtered_end());
166  }
167 
168  /// @}
169  /// @name Arg Removal
170  /// @{
171 
172  /// eraseArg - Remove any option matching \p Id.
173  void eraseArg(OptSpecifier Id);
174 
175  /// @}
176  /// @name Arg Access
177  /// @{
178 
179  /// hasArg - Does the arg list contain any option matching \p Id.
180  ///
181  /// \p Claim Whether the argument should be claimed, if it exists.
183  return getLastArgNoClaim(Id) != nullptr;
184  }
185  bool hasArg(OptSpecifier Id) const {
186  return getLastArg(Id) != nullptr;
187  }
188  bool hasArg(OptSpecifier Id0, OptSpecifier Id1) const {
189  return getLastArg(Id0, Id1) != nullptr;
190  }
191  bool hasArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const {
192  return getLastArg(Id0, Id1, Id2) != nullptr;
193  }
194 
195  /// getLastArg - Return the last argument matching \p Id, or null.
196  ///
197  /// \p Claim Whether the argument should be claimed, if it exists.
201  OptSpecifier Id2) const;
203  OptSpecifier Id3) const;
204  Arg *getLastArg(OptSpecifier Id) const;
205  Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1) const;
206  Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const;
208  OptSpecifier Id3) const;
210  OptSpecifier Id3, OptSpecifier Id4) const;
212  OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5) const;
214  OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5,
215  OptSpecifier Id6) const;
217  OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5,
218  OptSpecifier Id6, OptSpecifier Id7) const;
219 
220  /// getArgString - Return the input argument string at \p Index.
221  virtual const char *getArgString(unsigned Index) const = 0;
222 
223  /// getNumInputArgStrings - Return the number of original argument strings,
224  /// which are guaranteed to be the first strings in the argument string
225  /// list.
226  virtual unsigned getNumInputArgStrings() const = 0;
227 
228  /// @}
229  /// @name Argument Lookup Utilities
230  /// @{
231 
232  /// getLastArgValue - Return the value of the last argument, or a default.
234  StringRef Default = "") const;
235 
236  /// getAllArgValues - Get the values of all instances of the given argument
237  /// as strings.
238  std::vector<std::string> getAllArgValues(OptSpecifier Id) const;
239 
240  /// @}
241  /// @name Translation Utilities
242  /// @{
243 
244  /// hasFlag - Given an option \p Pos and its negative form \p Neg, return
245  /// true if the option is present, false if the negation is present, and
246  /// \p Default if neither option is given. If both the option and its
247  /// negation are present, the last one wins.
248  bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default=true) const;
249 
250  /// hasFlag - Given an option \p Pos, an alias \p PosAlias and its negative
251  /// form \p Neg, return true if the option or its alias is present, false if
252  /// the negation is present, and \p Default if none of the options are
253  /// given. If multiple options are present, the last one wins.
254  bool hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,
255  bool Default = true) const;
256 
257  /// AddLastArg - Render only the last argument match \p Id0, if present.
258  void AddLastArg(ArgStringList &Output, OptSpecifier Id0) const;
259  void AddLastArg(ArgStringList &Output, OptSpecifier Id0,
260  OptSpecifier Id1) const;
261 
262  /// AddAllArgsExcept - Render all arguments matching any of the given ids
263  /// and not matching any of the excluded ids.
265  ArrayRef<OptSpecifier> ExcludeIds) const;
266  /// AddAllArgs - Render all arguments matching any of the given ids.
267  void AddAllArgs(ArgStringList &Output, ArrayRef<OptSpecifier> Ids) const;
268 
269  /// AddAllArgs - Render all arguments matching the given ids.
270  void AddAllArgs(ArgStringList &Output, OptSpecifier Id0,
271  OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;
272 
273  /// AddAllArgValues - Render the argument values of all arguments
274  /// matching the given ids.
275  void AddAllArgValues(ArgStringList &Output, OptSpecifier Id0,
276  OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;
277 
278  /// AddAllArgsTranslated - Render all the arguments matching the
279  /// given ids, but forced to separate args and using the provided
280  /// name instead of the first option value.
281  ///
282  /// \param Joined - If true, render the argument as joined with
283  /// the option specifier.
285  const char *Translation,
286  bool Joined = false) const;
287 
288  /// ClaimAllArgs - Claim all arguments which match the given
289  /// option id.
290  void ClaimAllArgs(OptSpecifier Id0) const;
291 
292  /// ClaimAllArgs - Claim all arguments.
293  ///
294  void ClaimAllArgs() const;
295 
296  /// @}
297  /// @name Arg Synthesis
298  /// @{
299 
300  /// Construct a constant string pointer whose
301  /// lifetime will match that of the ArgList.
302  virtual const char *MakeArgStringRef(StringRef Str) const = 0;
303  const char *MakeArgString(const Twine &Str) const {
304  SmallString<256> Buf;
305  return MakeArgStringRef(Str.toStringRef(Buf));
306  }
307 
308  /// \brief Create an arg string for (\p LHS + \p RHS), reusing the
309  /// string at \p Index if possible.
310  const char *GetOrMakeJoinedArgString(unsigned Index, StringRef LHS,
311  StringRef RHS) const;
312 
313  void print(raw_ostream &O) const;
314  void dump() const;
315 
316  /// @}
317 };
318 
319 class InputArgList final : public ArgList {
320 private:
321  /// List of argument strings used by the contained Args.
322  ///
323  /// This is mutable since we treat the ArgList as being the list
324  /// of Args, and allow routines to add new strings (to have a
325  /// convenient place to store the memory) via MakeIndex.
326  mutable ArgStringList ArgStrings;
327 
328  /// Strings for synthesized arguments.
329  ///
330  /// This is mutable since we treat the ArgList as being the list
331  /// of Args, and allow routines to add new strings (to have a
332  /// convenient place to store the memory) via MakeIndex.
333  mutable std::list<std::string> SynthesizedStrings;
334 
335  /// The number of original input argument strings.
336  unsigned NumInputArgStrings;
337 
338  /// Release allocated arguments.
339  void releaseMemory();
340 
341 public:
342  InputArgList(const char* const *ArgBegin, const char* const *ArgEnd);
344  : ArgList(std::move(RHS)), ArgStrings(std::move(RHS.ArgStrings)),
345  SynthesizedStrings(std::move(RHS.SynthesizedStrings)),
346  NumInputArgStrings(RHS.NumInputArgStrings) {}
348  releaseMemory();
349  ArgList::operator=(std::move(RHS));
350  ArgStrings = std::move(RHS.ArgStrings);
351  SynthesizedStrings = std::move(RHS.SynthesizedStrings);
352  NumInputArgStrings = RHS.NumInputArgStrings;
353  return *this;
354  }
355  ~InputArgList() { releaseMemory(); }
356 
357  const char *getArgString(unsigned Index) const override {
358  return ArgStrings[Index];
359  }
360 
361  unsigned getNumInputArgStrings() const override {
362  return NumInputArgStrings;
363  }
364 
365  /// @name Arg Synthesis
366  /// @{
367 
368 public:
369  /// MakeIndex - Get an index for the given string(s).
370  unsigned MakeIndex(StringRef String0) const;
371  unsigned MakeIndex(StringRef String0, StringRef String1) const;
372 
374  const char *MakeArgStringRef(StringRef Str) const override;
375 
376  /// @}
377 };
378 
379 /// DerivedArgList - An ordered collection of driver arguments,
380 /// whose storage may be in another argument list.
381 class DerivedArgList final : public ArgList {
382  const InputArgList &BaseArgs;
383 
384  /// The list of arguments we synthesized.
385  mutable SmallVector<std::unique_ptr<Arg>, 16> SynthesizedArgs;
386 
387 public:
388  /// Construct a new derived arg list from \p BaseArgs.
389  DerivedArgList(const InputArgList &BaseArgs);
390 
391  const char *getArgString(unsigned Index) const override {
392  return BaseArgs.getArgString(Index);
393  }
394 
395  unsigned getNumInputArgStrings() const override {
396  return BaseArgs.getNumInputArgStrings();
397  }
398 
399  const InputArgList &getBaseArgs() const {
400  return BaseArgs;
401  }
402 
403  /// @name Arg Synthesis
404  /// @{
405 
406  /// AddSynthesizedArg - Add a argument to the list of synthesized arguments
407  /// (to be freed).
408  void AddSynthesizedArg(Arg *A);
409 
411  const char *MakeArgStringRef(StringRef Str) const override;
412 
413  /// AddFlagArg - Construct a new FlagArg for the given option \p Id and
414  /// append it to the argument list.
415  void AddFlagArg(const Arg *BaseArg, const Option Opt) {
416  append(MakeFlagArg(BaseArg, Opt));
417  }
418 
419  /// AddPositionalArg - Construct a new Positional arg for the given option
420  /// \p Id, with the provided \p Value and append it to the argument
421  /// list.
422  void AddPositionalArg(const Arg *BaseArg, const Option Opt,
423  StringRef Value) {
424  append(MakePositionalArg(BaseArg, Opt, Value));
425  }
426 
427 
428  /// AddSeparateArg - Construct a new Positional arg for the given option
429  /// \p Id, with the provided \p Value and append it to the argument
430  /// list.
431  void AddSeparateArg(const Arg *BaseArg, const Option Opt,
432  StringRef Value) {
433  append(MakeSeparateArg(BaseArg, Opt, Value));
434  }
435 
436 
437  /// AddJoinedArg - Construct a new Positional arg for the given option
438  /// \p Id, with the provided \p Value and append it to the argument list.
439  void AddJoinedArg(const Arg *BaseArg, const Option Opt,
440  StringRef Value) {
441  append(MakeJoinedArg(BaseArg, Opt, Value));
442  }
443 
444 
445  /// MakeFlagArg - Construct a new FlagArg for the given option \p Id.
446  Arg *MakeFlagArg(const Arg *BaseArg, const Option Opt) const;
447 
448  /// MakePositionalArg - Construct a new Positional arg for the
449  /// given option \p Id, with the provided \p Value.
450  Arg *MakePositionalArg(const Arg *BaseArg, const Option Opt,
451  StringRef Value) const;
452 
453  /// MakeSeparateArg - Construct a new Positional arg for the
454  /// given option \p Id, with the provided \p Value.
455  Arg *MakeSeparateArg(const Arg *BaseArg, const Option Opt,
456  StringRef Value) const;
457 
458  /// MakeJoinedArg - Construct a new Positional arg for the
459  /// given option \p Id, with the provided \p Value.
460  Arg *MakeJoinedArg(const Arg *BaseArg, const Option Opt,
461  StringRef Value) const;
462 
463  /// @}
464 };
465 
466 } // end namespace opt
467 } // end namespace llvm
468 
469 #endif
const_reverse_iterator rend() const
Definition: ArgList.h:152
std::reverse_iterator< iterator > reverse_iterator
Definition: SmallVector.h:106
arg_iterator operator++(int)
Definition: ArgList.h:74
iterator begin()
Definition: ArgList.h:142
void AddSeparateArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddSeparateArg - Construct a new Positional arg for the given option Id, with the provided Value and ...
Definition: ArgList.h:431
bool hasArgNoClaim(OptSpecifier Id) const
hasArg - Does the arg list contain any option matching Id.
Definition: ArgList.h:182
virtual const char * MakeArgStringRef(StringRef Str) const =0
Construct a constant string pointer whose lifetime will match that of the ArgList.
void AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0, const char *Translation, bool Joined=false) const
AddAllArgsTranslated - Render all the arguments matching the given ids, but forced to separate args a...
Definition: ArgList.cpp:311
Arg * MakeFlagArg(const Arg *BaseArg, const Option Opt) const
MakeFlagArg - Construct a new FlagArg for the given option Id.
Definition: ArgList.cpp:408
arglist_type::const_iterator const_iterator
Definition: ArgList.h:98
InputArgList & operator=(InputArgList &&RHS)
Definition: ArgList.h:347
const InputArgList & getBaseArgs() const
Definition: ArgList.h:399
arglist_type::const_reverse_iterator const_reverse_iterator
Definition: ArgList.h:100
void eraseArg(OptSpecifier Id)
eraseArg - Remove any option matching Id.
Definition: ArgList.cpp:41
reverse_iterator rbegin()
Definition: ArgList.h:145
const char * getArgString(unsigned Index) const override
getArgString - Return the input argument string at Index.
Definition: ArgList.h:391
const char * getArgString(unsigned Index) const override
getArgString - Return the input argument string at Index.
Definition: ArgList.h:357
unsigned MakeIndex(StringRef String0) const
MakeIndex - Get an index for the given string(s).
Definition: ArgList.cpp:372
unsigned getNumInputArgStrings() const override
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
Definition: ArgList.h:395
void AddFlagArg(const Arg *BaseArg, const Option Opt)
AddFlagArg - Construct a new FlagArg for the given option Id and append it to the argument list...
Definition: ArgList.h:415
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
arg_iterator - Iterates through arguments stored inside an ArgList.
Definition: ArgList.h:31
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:32
arglist_type::iterator iterator
Definition: ArgList.h:97
Arg *const & reference
Definition: ArgList.h:52
virtual unsigned getNumInputArgStrings() const =0
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
bool hasArg(OptSpecifier Id) const
Definition: ArgList.h:185
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
ArgList(ArgList &&RHS)
Definition: ArgList.h:116
void AddAllArgs(ArgStringList &Output, ArrayRef< OptSpecifier > Ids) const
AddAllArgs - Render all arguments matching any of the given ids.
Definition: ArgList.cpp:286
void AddSynthesizedArg(Arg *A)
AddSynthesizedArg - Add a argument to the list of synthesized arguments (to be freed).
Definition: ArgList.cpp:404
Arg * getLastArgNoClaim(OptSpecifier Id) const
getLastArg - Return the last argument matching Id, or null.
Definition: ArgList.cpp:47
void print(raw_ostream &O) const
Definition: ArgList.cpp:349
const char * MakeArgStringRef(StringRef Str) const override
Construct a constant string pointer whose lifetime will match that of the ArgList.
Definition: ArgList.cpp:400
Option - Abstract representation for a single form of driver argument.
Definition: Option.h:44
arg_iterator filtered_end() const
Definition: ArgList.h:158
iterator end()
Definition: ArgList.h:143
A concrete instance of a particular driver option.
Definition: Arg.h:31
DerivedArgList(const InputArgList &BaseArgs)
Construct a new derived arg list from BaseArgs.
Definition: ArgList.cpp:397
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Definition: SmallVector.h:115
bool hasArg(OptSpecifier Id0, OptSpecifier Id1) const
Definition: ArgList.h:188
Arg *const * pointer
Definition: ArgList.h:53
const arglist_type & getArgs() const
Definition: ArgList.h:134
arg_iterator & operator++()
Definition: ArgList.h:68
Arg *const * value_type
Definition: ArgList.h:51
const char * GetOrMakeJoinedArgString(unsigned Index, StringRef LHS, StringRef RHS) const
Create an arg string for (LHS + RHS), reusing the string at Index if possible.
Definition: ArgList.cpp:338
reference operator*() const
Definition: ArgList.h:65
bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default=true) const
hasFlag - Given an option Pos and its negative form Neg, return true if the option is present...
Definition: ArgList.cpp:221
const char * MakeArgString(const Twine &Str) const
Definition: ArgList.h:303
arglist_type & getArgs()
Definition: ArgList.h:133
reverse_iterator rend()
Definition: ArgList.h:146
iterator_range< arg_iterator > filtered(OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
Definition: ArgList.h:162
void AddLastArg(ArgStringList &Output, OptSpecifier Id0) const
AddLastArg - Render only the last argument match Id0, if present.
Definition: ArgList.cpp:247
void AddAllArgValues(ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
AddAllArgValues - Render the argument values of all arguments matching the given ids.
Definition: ArgList.cpp:302
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
ArgList & operator=(ArgList &&RHS)
Definition: ArgList.h:117
void AddAllArgsExcept(ArgStringList &Output, ArrayRef< OptSpecifier > Ids, ArrayRef< OptSpecifier > ExcludeIds) const
AddAllArgsExcept - Render all arguments matching any of the given ids and not matching any of the exc...
Definition: ArgList.cpp:262
virtual const char * getArgString(unsigned Index) const =0
getArgString - Return the input argument string at Index.
bool hasArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const
Definition: ArgList.h:191
Arg * MakeJoinedArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakeJoinedArg - Construct a new Positional arg for the given option Id, with the provided Value...
Definition: ArgList.cpp:433
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
Definition: Twine.h:463
void AddPositionalArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddPositionalArg - Construct a new Positional arg for the given option Id, with the provided Value an...
Definition: ArgList.h:422
InputArgList(InputArgList &&RHS)
Definition: ArgList.h:343
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: SmallVector.h:105
A range adaptor for a pair of iterators.
unsigned size() const
Definition: ArgList.h:136
Defines the llvm::Arg class for parsed arguments.
arglist_type::reverse_iterator reverse_iterator
Definition: ArgList.h:99
friend bool operator!=(arg_iterator LHS, arg_iterator RHS)
Definition: ArgList.h:83
Arg * MakeSeparateArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakeSeparateArg - Construct a new Positional arg for the given option Id, with the provided Value...
Definition: ArgList.cpp:424
friend bool operator==(arg_iterator LHS, arg_iterator RHS)
Definition: ArgList.h:80
Arg * MakePositionalArg(const Arg *BaseArg, const Option Opt, StringRef Value) const
MakePositionalArg - Construct a new Positional arg for the given option Id, with the provided Value...
Definition: ArgList.cpp:415
const_iterator end() const
Definition: ArgList.h:149
void ClaimAllArgs() const
ClaimAllArgs - Claim all arguments.
Definition: ArgList.cpp:332
void append(Arg *A)
append - Append A to the arg list.
Definition: ArgList.cpp:37
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Definition: SmallVector.h:119
OptSpecifier - Wrapper class for abstracting references to option IDs.
Definition: OptSpecifier.h:20
unsigned getNumInputArgStrings() const override
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be th...
Definition: ArgList.h:361
arg_iterator(SmallVectorImpl< Arg * >::const_iterator it, const ArgList &Args, OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U)
Definition: ArgList.h:57
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
Definition: SmallVector.h:135
Arg * getLastArg(OptSpecifier Id) const
Definition: ArgList.cpp:84
InputArgList(const char *const *ArgBegin, const char *const *ArgEnd)
Definition: ArgList.cpp:366
std::vector< std::string > getAllArgValues(OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
Definition: ArgList.cpp:241
LLVM Value Representation.
Definition: Value.h:71
const_iterator begin() const
Definition: ArgList.h:148
arg_iterator filtered_begin(OptSpecifier Id0=0U, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
Definition: ArgList.h:154
pointer operator->() const
Definition: ArgList.h:66
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
DerivedArgList - An ordered collection of driver arguments, whose storage may be in another argument ...
Definition: ArgList.h:381
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
ArgList - Ordered collection of driver arguments.
Definition: ArgList.h:94
std::ptrdiff_t difference_type
Definition: ArgList.h:55
const char * MakeArgStringRef(StringRef Str) const override
Construct a constant string pointer whose lifetime will match that of the ArgList.
Definition: ArgList.cpp:391
StringRef getLastArgValue(OptSpecifier Id, StringRef Default="") const
getLastArgValue - Return the value of the last argument, or a default.
Definition: ArgList.cpp:234
const_reverse_iterator rbegin() const
Definition: ArgList.h:151
void dump() const
Definition: ArgList.cpp:356
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
void AddJoinedArg(const Arg *BaseArg, const Option Opt, StringRef Value)
AddJoinedArg - Construct a new Positional arg for the given option Id, with the provided Value and ap...
Definition: ArgList.h:439
SmallVector< Arg *, 16 > arglist_type
Definition: ArgList.h:96
std::forward_iterator_tag iterator_category
Definition: ArgList.h:54