Coverage Report

Created: 2020-06-26 05:44

/home/arjun/llvm-project/llvm/include/llvm/Support/CommandLine.h
Line
Count
Source (jump to first uncovered line)
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"
31
#include "llvm/ADT/iterator_range.h"
32
#include "llvm/Support/ErrorHandling.h"
33
#include "llvm/Support/ManagedStatic.h"
34
#include "llvm/Support/VirtualFileSystem.h"
35
#include "llvm/Support/raw_ostream.h"
36
#include <cassert>
37
#include <climits>
38
#include <cstddef>
39
#include <functional>
40
#include <initializer_list>
41
#include <string>
42
#include <type_traits>
43
#include <vector>
44
45
namespace llvm {
46
47
class StringSaver;
48
49
/// cl Namespace - This namespace contains all of the command line option
50
/// processing machinery.  It is intentionally a short name to make qualified
51
/// usage concise.
52
namespace cl {
53
54
//===----------------------------------------------------------------------===//
55
// ParseCommandLineOptions - Command line option processing entry point.
56
//
57
// Returns true on success. Otherwise, this will print the error message to
58
// stderr and exit if \p Errs is not set (nullptr by default), or print the
59
// error message to \p Errs and return false if \p Errs is provided.
60
//
61
// If EnvVar is not nullptr, command-line options are also parsed from the
62
// environment variable named by EnvVar.  Precedence is given to occurrences
63
// from argv.  This precedence is currently implemented by parsing argv after
64
// the environment variable, so it is only implemented correctly for options
65
// that give precedence to later occurrences.  If your program supports options
66
// that give precedence to earlier occurrences, you will need to extend this
67
// function to support it correctly.
68
bool ParseCommandLineOptions(int argc, const char *const *argv,
69
                             StringRef Overview = "",
70
                             raw_ostream *Errs = nullptr,
71
                             const char *EnvVar = nullptr,
72
                             bool LongOptionsUseDoubleDash = false);
73
74
//===----------------------------------------------------------------------===//
75
// ParseEnvironmentOptions - Environment variable option processing alternate
76
//                           entry point.
77
//
78
void ParseEnvironmentOptions(const char *progName, const char *envvar,
79
                             const char *Overview = "");
80
81
// Function pointer type for printing version information.
82
using VersionPrinterTy = std::function<void(raw_ostream &)>;
83
84
///===---------------------------------------------------------------------===//
85
/// SetVersionPrinter - Override the default (LLVM specific) version printer
86
///                     used to print out the version when --version is given
87
///                     on the command line. This allows other systems using the
88
///                     CommandLine utilities to print their own version string.
89
void SetVersionPrinter(VersionPrinterTy func);
90
91
///===---------------------------------------------------------------------===//
92
/// AddExtraVersionPrinter - Add an extra printer to use in addition to the
93
///                          default one. This can be called multiple times,
94
///                          and each time it adds a new function to the list
95
///                          which will be called after the basic LLVM version
96
///                          printing is complete. Each can then add additional
97
///                          information specific to the tool.
98
void AddExtraVersionPrinter(VersionPrinterTy func);
99
100
// PrintOptionValues - Print option values.
101
// With -print-options print the difference between option values and defaults.
102
// With -print-all-options print all option values.
103
// (Currently not perfect, but best-effort.)
104
void PrintOptionValues();
105
106
// Forward declaration - AddLiteralOption needs to be up here to make gcc happy.
107
class Option;
108
109
/// Adds a new option for parsing and provides the option it refers to.
110
///
111
/// \param O pointer to the option
112
/// \param Name the string name for the option to handle during parsing
113
///
114
/// Literal options are used by some parsers to register special option values.
115
/// This is how the PassNameParser registers pass names for opt.
116
void AddLiteralOption(Option &O, StringRef Name);
117
118
//===----------------------------------------------------------------------===//
119
// Flags permitted to be passed to command line arguments
120
//
121
122
enum NumOccurrencesFlag { // Flags for the number of occurrences allowed
123
  Optional = 0x00,        // Zero or One occurrence
124
  ZeroOrMore = 0x01,      // Zero or more occurrences allowed
125
  Required = 0x02,        // One occurrence required
126
  OneOrMore = 0x03,       // One or more occurrences required
127
128
  // ConsumeAfter - Indicates that this option is fed anything that follows the
129
  // last positional argument required by the application (it is an error if
130
  // there are zero positional arguments, and a ConsumeAfter option is used).
131
  // Thus, for example, all arguments to LLI are processed until a filename is
132
  // found.  Once a filename is found, all of the succeeding arguments are
133
  // passed, unprocessed, to the ConsumeAfter option.
134
  //
135
  ConsumeAfter = 0x04
136
};
137
138
enum ValueExpected { // Is a value required for the option?
139
  // zero reserved for the unspecified value
140
  ValueOptional = 0x01,  // The value can appear... or not
141
  ValueRequired = 0x02,  // The value is required to appear!
142
  ValueDisallowed = 0x03 // A value may not be specified (for flags)
143
};
144
145
enum OptionHidden {   // Control whether -help shows this option
146
  NotHidden = 0x00,   // Option included in -help & -help-hidden
147
  Hidden = 0x01,      // -help doesn't, but -help-hidden does
148
  ReallyHidden = 0x02 // Neither -help nor -help-hidden show this arg
149
};
150
151
// Formatting flags - This controls special features that the option might have
152
// that cause it to be parsed differently...
153
//
154
// Prefix - This option allows arguments that are otherwise unrecognized to be
155
// matched by options that are a prefix of the actual value.  This is useful for
156
// cases like a linker, where options are typically of the form '-lfoo' or
157
// '-L../../include' where -l or -L are the actual flags.  When prefix is
158
// enabled, and used, the value for the flag comes from the suffix of the
159
// argument.
160
//
161
// AlwaysPrefix - Only allow the behavior enabled by the Prefix flag and reject
162
// the Option=Value form.
163
//
164
165
enum FormattingFlags {
166
  NormalFormatting = 0x00, // Nothing special
167
  Positional = 0x01,       // Is a positional argument, no '-' required
168
  Prefix = 0x02,           // Can this option directly prefix its value?
169
  AlwaysPrefix = 0x03      // Can this option only directly prefix its value?
170
};
171
172
enum MiscFlags {             // Miscellaneous flags to adjust argument
173
  CommaSeparated = 0x01,     // Should this cl::list split between commas?
174
  PositionalEatsArgs = 0x02, // Should this positional cl::list eat -args?
175
  Sink = 0x04,               // Should this cl::list eat all unknown options?
176
177
  // Grouping - Can this option group with other options?
178
  // If this is enabled, multiple letter options are allowed to bunch together
179
  // with only a single hyphen for the whole group.  This allows emulation
180
  // of the behavior that ls uses for example: ls -la === ls -l -a
181
  Grouping = 0x08,
182
183
  // Default option
184
  DefaultOption = 0x10
185
};
186
187
//===----------------------------------------------------------------------===//
188
// Option Category class
189
//
190
class OptionCategory {
191
private:
192
  StringRef const Name;
193
  StringRef const Description;
194
195
  void registerCategory();
196
197
public:
198
  OptionCategory(StringRef const Name,
199
                 StringRef const Description = "")
200
6
      : Name(Name), Description(Description) {
201
6
    registerCategory();
202
6
  }
203
204
12
  StringRef getName() const { return Name; }
205
0
  StringRef getDescription() const { return Description; }
206
};
207
208
// The general Option Category (used as default category).
209
extern OptionCategory GeneralCategory;
210
211
//===----------------------------------------------------------------------===//
212
// SubCommand class
213
//
214
class SubCommand {
215
private:
216
  StringRef Name;
217
  StringRef Description;
218
219
protected:
220
  void registerSubCommand();
221
  void unregisterSubCommand();
222
223
public:
224
  SubCommand(StringRef Name, StringRef Description = "")
225
0
      : Name(Name), Description(Description) {
226
0
        registerSubCommand();
227
0
  }
228
4
  SubCommand() = default;
229
230
  void reset();
231
232
  explicit operator bool() const;
233
234
2
  StringRef getName() const { return Name; }
235
0
  StringRef getDescription() const { return Description; }
236
237
  SmallVector<Option *, 4> PositionalOpts;
238
  SmallVector<Option *, 4> SinkOpts;
239
  StringMap<Option *> OptionsMap;
240
241
  Option *ConsumeAfterOpt = nullptr; // The ConsumeAfter option if it exists.
242
};
243
244
// A special subcommand representing no subcommand
245
extern ManagedStatic<SubCommand> TopLevelSubCommand;
246
247
// A special subcommand that can be used to put an option into all subcommands.
248
extern ManagedStatic<SubCommand> AllSubCommands;
249
250
//===----------------------------------------------------------------------===//
251
// Option Base class
252
//
253
class Option {
254
  friend class alias;
255
256
  // handleOccurrences - Overriden by subclasses to handle the value passed into
257
  // an argument.  Should return true if there was an error processing the
258
  // argument and the program should exit.
259
  //
260
  virtual bool handleOccurrence(unsigned pos, StringRef ArgName,
261
                                StringRef Arg) = 0;
262
263
0
  virtual enum ValueExpected getValueExpectedFlagDefault() const {
264
0
    return ValueOptional;
265
0
  }
266
267
  // Out of line virtual function to provide home for the class.
268
  virtual void anchor();
269
270
  uint16_t NumOccurrences; // The number of times specified
271
  // Occurrences, HiddenFlag, and Formatting are all enum types but to avoid
272
  // problems with signed enums in bitfields.
273
  uint16_t Occurrences : 3; // enum NumOccurrencesFlag
274
  // not using the enum type for 'Value' because zero is an implementation
275
  // detail representing the non-value
276
  uint16_t Value : 2;
277
  uint16_t HiddenFlag : 2; // enum OptionHidden
278
  uint16_t Formatting : 2; // enum FormattingFlags
279
  uint16_t Misc : 5;
280
  uint16_t FullyInitialized : 1; // Has addArgument been called?
281
  uint16_t Position;             // Position of last occurrence of the option
282
  uint16_t AdditionalVals;       // Greater than 0 for multi-valued option.
283
284
public:
285
  StringRef ArgStr;   // The argument string itself (ex: "help", "o")
286
  StringRef HelpStr;  // The descriptive text message for -help
287
  StringRef ValueStr; // String describing what the value of this option is
288
  SmallVector<OptionCategory *, 1>
289
      Categories;                    // The Categories this option belongs to
290
  SmallPtrSet<SubCommand *, 1> Subs; // The subcommands this option belongs to.
291
292
66
  inline enum NumOccurrencesFlag getNumOccurrencesFlag() const {
293
66
    return (enum NumOccurrencesFlag)Occurrences;
294
66
  }
295
296
0
  inline enum ValueExpected getValueExpectedFlag() const {
297
0
    return Value ? ((enum ValueExpected)Value) : getValueExpectedFlagDefault();
298
0
  }
299
300
0
  inline enum OptionHidden getOptionHiddenFlag() const {
301
0
    return (enum OptionHidden)HiddenFlag;
302
0
  }
303
304
40
  inline enum FormattingFlags getFormattingFlag() const {
305
40
    return (enum FormattingFlags)Formatting;
306
40
  }
307
308
106
  inline unsigned getMiscFlags() const { return Misc; }
309
0
  inline unsigned getPosition() const { return Position; }
310
0
  inline unsigned getNumAdditionalVals() const { return AdditionalVals; }
311
312
  // hasArgStr - Return true if the argstr != ""
313
42
  bool hasArgStr() const { return !ArgStr.empty(); }
314
0
  bool isPositional() const { return getFormattingFlag() == cl::Positional; }
315
0
  bool isSink() const { return getMiscFlags() & cl::Sink; }
316
66
  bool isDefaultOption() const { return getMiscFlags() & cl::DefaultOption; }
317
318
0
  bool isConsumeAfter() const {
319
0
    return getNumOccurrencesFlag() == cl::ConsumeAfter;
320
0
  }
321
322
0
  bool isInAllSubCommands() const {
323
0
    return any_of(Subs, [](const SubCommand *SC) {
324
0
      return SC == &*AllSubCommands;
325
0
    });
326
0
  }
327
328
  //-------------------------------------------------------------------------===
329
  // Accessor functions set by OptionModifiers
330
  //
331
  void setArgStr(StringRef S);
332
26
  void setDescription(StringRef S) { HelpStr = S; }
333
2
  void setValueStr(StringRef S) { ValueStr = S; }
334
2
  void setNumOccurrencesFlag(enum NumOccurrencesFlag Val) { Occurrences = Val; }
335
12
  void setValueExpectedFlag(enum ValueExpected Val) { Value = Val; }
336
18
  void setHiddenFlag(enum OptionHidden Val) { HiddenFlag = Val; }
337
0
  void setFormattingFlag(enum FormattingFlags V) { Formatting = V; }
338
4
  void setMiscFlag(enum MiscFlags M) { Misc |= M; }
339
0
  void setPosition(unsigned pos) { Position = pos; }
340
  void addCategory(OptionCategory &C);
341
12
  void addSubCommand(SubCommand &S) { Subs.insert(&S); }
342
343
protected:
344
  explicit Option(enum NumOccurrencesFlag OccurrencesFlag,
345
                  enum OptionHidden Hidden)
346
      : NumOccurrences(0), Occurrences(OccurrencesFlag), Value(0),
347
        HiddenFlag(Hidden), Formatting(NormalFormatting), Misc(0),
348
26
        FullyInitialized(false), Position(0), AdditionalVals(0) {
349
26
    Categories.push_back(&GeneralCategory);
350
26
  }
351
352
0
  inline void setNumAdditionalVals(unsigned n) { AdditionalVals = n; }
353
354
public:
355
0
  virtual ~Option() = default;
356
357
  // addArgument - Register this argument with the commandline system.
358
  //
359
  void addArgument();
360
361
  /// Unregisters this option from the CommandLine system.
362
  ///
363
  /// This option must have been the last option registered.
364
  /// For testing purposes only.
365
  void removeArgument();
366
367
  // Return the width of the option tag for printing...
368
  virtual size_t getOptionWidth() const = 0;
369
370
  // printOptionInfo - Print out information about this option.  The
371
  // to-be-maintained width is specified.
372
  //
373
  virtual void printOptionInfo(size_t GlobalWidth) const = 0;
374
375
  virtual void printOptionValue(size_t GlobalWidth, bool Force) const = 0;
376
377
  virtual void setDefault() = 0;
378
379
  static void printHelpStr(StringRef HelpStr, size_t Indent,
380
                           size_t FirstLineIndentedBy);
381
382
0
  virtual void getExtraOptionNames(SmallVectorImpl<StringRef> &) {}
383
384
  // addOccurrence - Wrapper around handleOccurrence that enforces Flags.
385
  //
386
  virtual bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value,
387
                             bool MultiArg = false);
388
389
  // Prints option name followed by message.  Always returns true.
390
  bool error(const Twine &Message, StringRef ArgName = StringRef(), raw_ostream &Errs = llvm::errs());
391
0
  bool error(const Twine &Message, raw_ostream &Errs) {
392
0
    return error(Message, StringRef(), Errs);
393
0
  }
394
395
0
  inline int getNumOccurrences() const { return NumOccurrences; }
396
  void reset();
397
};
398
399
//===----------------------------------------------------------------------===//
400
// Command line option modifiers that can be used to modify the behavior of
401
// command line option parsers...
402
//
403
404
// desc - Modifier to set the description shown in the -help output...
405
struct desc {
406
  StringRef Desc;
407
408
26
  desc(StringRef Str) : Desc(Str) {}
409
410
26
  void apply(Option &O) const { O.setDescription(Desc); }
411
};
412
413
// value_desc - Modifier to set the value description shown in the -help
414
// output...
415
struct value_desc {
416
  StringRef Desc;
417
418
2
  value_desc(StringRef Str) : Desc(Str) {}
419
420
2
  void apply(Option &O) const { O.setValueStr(Desc); }
421
};
422
423
// init - Specify a default (initial) value for the command line argument, if
424
// the default constructor for the argument type does not give you what you
425
// want.  This is only valid on "opt" arguments, not on "list" arguments.
426
//
427
template <class Ty> struct initializer {
428
  const Ty &Init;
429
8
  initializer(const Ty &Val) : Init(Val) {}
_ZN4llvm2cl11initializerIiEC2ERKi
Line
Count
Source
429
2
  initializer(const Ty &Val) : Init(Val) {}
_ZN4llvm2cl11initializerIbEC2ERKb
Line
Count
Source
429
4
  initializer(const Ty &Val) : Init(Val) {}
_ZN4llvm2cl11initializerINS0_13boolOrDefaultEEC2ERKS2_
Line
Count
Source
429
2
  initializer(const Ty &Val) : Init(Val) {}
430
431
8
  template <class Opt> void apply(Opt &O) const { O.setInitialValue(Init); }
_ZNK4llvm2cl11initializerIiE5applyINS0_3optIjLb0ENS0_6parserIjEEEEEEvRT_
Line
Count
Source
431
2
  template <class Opt> void apply(Opt &O) const { O.setInitialValue(Init); }
_ZNK4llvm2cl11initializerIbE5applyINS0_3optIbLb0ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
431
4
  template <class Opt> void apply(Opt &O) const { O.setInitialValue(Init); }
_ZNK4llvm2cl11initializerINS0_13boolOrDefaultEE5applyINS0_3optIS2_Lb0ENS0_6parserIS2_EEEEEEvRT_
Line
Count
Source
431
2
  template <class Opt> void apply(Opt &O) const { O.setInitialValue(Init); }
432
};
433
434
8
template <class Ty> initializer<Ty> init(const Ty &Val) {
435
8
  return initializer<Ty>(Val);
436
8
}
_ZN4llvm2cl4initIiEENS0_11initializerIT_EERKS3_
Line
Count
Source
434
2
template <class Ty> initializer<Ty> init(const Ty &Val) {
435
2
  return initializer<Ty>(Val);
436
2
}
_ZN4llvm2cl4initIbEENS0_11initializerIT_EERKS3_
Line
Count
Source
434
4
template <class Ty> initializer<Ty> init(const Ty &Val) {
435
4
  return initializer<Ty>(Val);
436
4
}
_ZN4llvm2cl4initINS0_13boolOrDefaultEEENS0_11initializerIT_EERKS4_
Line
Count
Source
434
2
template <class Ty> initializer<Ty> init(const Ty &Val) {
435
2
  return initializer<Ty>(Val);
436
2
}
437
438
// location - Allow the user to specify which external variable they want to
439
// store the results of the command line argument processing into, if they don't
440
// want to store it in the option itself.
441
//
442
template <class Ty> struct LocationClass {
443
  Ty &Loc;
444
445
16
  LocationClass(Ty &L) : Loc(L) {}
_ZN4llvm2cl13LocationClassIbEC2ERb
Line
Count
Source
445
4
  LocationClass(Ty &L) : Loc(L) {}
Debug.cpp:_ZN4llvm2cl13LocationClassIN12_GLOBAL__N_112DebugOnlyOptEEC2ERS3_
Line
Count
Source
445
2
  LocationClass(Ty &L) : Loc(L) {}
CommandLine.cpp:_ZN4llvm2cl13LocationClassIN12_GLOBAL__N_111HelpPrinterEEC2ERS3_
Line
Count
Source
445
4
  LocationClass(Ty &L) : Loc(L) {}
CommandLine.cpp:_ZN4llvm2cl13LocationClassIN12_GLOBAL__N_118HelpPrinterWrapperEEC2ERS3_
Line
Count
Source
445
4
  LocationClass(Ty &L) : Loc(L) {}
CommandLine.cpp:_ZN4llvm2cl13LocationClassIN12_GLOBAL__N_114VersionPrinterEEC2ERS3_
Line
Count
Source
445
2
  LocationClass(Ty &L) : Loc(L) {}
446
447
16
  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
_ZNK4llvm2cl13LocationClassIbE5applyINS0_3optIbLb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
447
4
  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
Debug.cpp:_ZNK4llvm2cl13LocationClassIN12_GLOBAL__N_112DebugOnlyOptEE5applyINS0_3optIS3_Lb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEEEEvRT_
Line
Count
Source
447
2
  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
CommandLine.cpp:_ZNK4llvm2cl13LocationClassIN12_GLOBAL__N_111HelpPrinterEE5applyINS0_3optIS3_Lb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
447
4
  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
CommandLine.cpp:_ZNK4llvm2cl13LocationClassIN12_GLOBAL__N_118HelpPrinterWrapperEE5applyINS0_3optIS3_Lb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
447
4
  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
CommandLine.cpp:_ZNK4llvm2cl13LocationClassIN12_GLOBAL__N_114VersionPrinterEE5applyINS0_3optIS3_Lb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
447
2
  template <class Opt> void apply(Opt &O) const { O.setLocation(O, Loc); }
448
};
449
450
16
template <class Ty> LocationClass<Ty> location(Ty &L) {
451
16
  return LocationClass<Ty>(L);
452
16
}
_ZN4llvm2cl8locationIbEENS0_13LocationClassIT_EERS3_
Line
Count
Source
450
4
template <class Ty> LocationClass<Ty> location(Ty &L) {
451
4
  return LocationClass<Ty>(L);
452
4
}
Debug.cpp:_ZN4llvm2cl8locationIN12_GLOBAL__N_112DebugOnlyOptEEENS0_13LocationClassIT_EERS5_
Line
Count
Source
450
2
template <class Ty> LocationClass<Ty> location(Ty &L) {
451
2
  return LocationClass<Ty>(L);
452
2
}
CommandLine.cpp:_ZN4llvm2cl8locationIN12_GLOBAL__N_111HelpPrinterEEENS0_13LocationClassIT_EERS5_
Line
Count
Source
450
4
template <class Ty> LocationClass<Ty> location(Ty &L) {
451
4
  return LocationClass<Ty>(L);
452
4
}
CommandLine.cpp:_ZN4llvm2cl8locationIN12_GLOBAL__N_118HelpPrinterWrapperEEENS0_13LocationClassIT_EERS5_
Line
Count
Source
450
4
template <class Ty> LocationClass<Ty> location(Ty &L) {
451
4
  return LocationClass<Ty>(L);
452
4
}
CommandLine.cpp:_ZN4llvm2cl8locationIN12_GLOBAL__N_114VersionPrinterEEENS0_13LocationClassIT_EERS5_
Line
Count
Source
450
2
template <class Ty> LocationClass<Ty> location(Ty &L) {
451
2
  return LocationClass<Ty>(L);
452
2
}
453
454
// cat - Specifiy the Option category for the command line argument to belong
455
// to.
456
struct cat {
457
  OptionCategory &Category;
458
459
16
  cat(OptionCategory &c) : Category(c) {}
460
461
16
  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
CommandLine.cpp:_ZNK4llvm2cl3cat5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
461
4
  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
CommandLine.cpp:_ZNK4llvm2cl3cat5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
461
4
  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
_ZNK4llvm2cl3cat5applyINS0_3optIbLb0ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
461
4
  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
CommandLine.cpp:_ZNK4llvm2cl3cat5applyINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
461
2
  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
_ZNK4llvm2cl3cat5applyINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS4_EEEEEEvRT_
Line
Count
Source
461
2
  template <class Opt> void apply(Opt &O) const { O.addCategory(Category); }
462
};
463
464
// sub - Specify the subcommand that this option belongs to.
465
struct sub {
466
  SubCommand &Sub;
467
468
12
  sub(SubCommand &S) : Sub(S) {}
469
470
12
  template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); }
CommandLine.cpp:_ZNK4llvm2cl3sub5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
470
4
  template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); }
CommandLine.cpp:_ZNK4llvm2cl3sub5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
470
4
  template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); }
_ZNK4llvm2cl3sub5applyINS0_3optIbLb0ENS0_6parserIbEEEEEEvRT_
Line
Count
Source
470
4
  template <class Opt> void apply(Opt &O) const { O.addSubCommand(Sub); }
471
};
472
473
// Specify a callback function to be called when an option is seen.
474
// Can be used to set other options automatically.
475
template <typename R, typename Ty> struct cb {
476
  std::function<R(Ty)> CB;
477
478
  cb(std::function<R(Ty)> CB) : CB(CB) {}
479
480
  template <typename Opt> void apply(Opt &O) const { O.setCallback(CB); }
481
};
482
483
namespace detail {
484
template <typename F>
485
struct callback_traits : public callback_traits<decltype(&F::operator())> {};
486
487
template <typename R, typename C, typename... Args>
488
struct callback_traits<R (C::*)(Args...) const> {
489
  using result_type = R;
490
  using arg_type = std::tuple_element_t<0, std::tuple<Args...>>;
491
  static_assert(sizeof...(Args) == 1, "callback function must have one and only one parameter");
492
  static_assert(std::is_same<result_type, void>::value,
493
                "callback return type must be void");
494
  static_assert(std::is_lvalue_reference<arg_type>::value &&
495
                    std::is_const<std::remove_reference_t<arg_type>>::value,
496
                "callback arg_type must be a const lvalue reference");
497
};
498
} // namespace detail
499
500
template <typename F>
501
cb<typename detail::callback_traits<F>::result_type,
502
   typename detail::callback_traits<F>::arg_type>
503
callback(F CB) {
504
  using result_type = typename detail::callback_traits<F>::result_type;
505
  using arg_type = typename detail::callback_traits<F>::arg_type;
506
  return cb<result_type, arg_type>(CB);
507
}
508
509
//===----------------------------------------------------------------------===//
510
// OptionValue class
511
512
// Support value comparison outside the template.
513
struct GenericOptionValue {
514
  virtual bool compare(const GenericOptionValue &V) const = 0;
515
516
protected:
517
24
  GenericOptionValue() = default;
518
0
  GenericOptionValue(const GenericOptionValue&) = default;
519
  GenericOptionValue &operator=(const GenericOptionValue &) = default;
520
  ~GenericOptionValue() = default;
521
522
private:
523
  virtual void anchor();
524
};
525
526
template <class DataType> struct OptionValue;
527
528
// The default value safely does nothing. Option value printing is only
529
// best-effort.
530
template <class DataType, bool isClass>
531
struct OptionValueBase : public GenericOptionValue {
532
  // Temporary storage for argument passing.
533
  using WrapperType = OptionValue<DataType>;
534
535
0
  bool hasValue() const { return false; }
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_112DebugOnlyOptELb1EE8hasValueEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_114VersionPrinterELb1EE8hasValueEv
536
537
0
  const DataType &getValue() const { llvm_unreachable("no default value"); }
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_112DebugOnlyOptELb1EE8getValueEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_114VersionPrinterELb1EE8getValueEv
538
539
  // Some options may take their value from a different data type.
540
12
  template <class DT> void setValue(const DT & /*V*/) {}
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_112DebugOnlyOptELb1EE8setValueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvRKT_
Debug.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_112DebugOnlyOptELb1EE8setValueIS3_EEvRKT_
Line
Count
Source
540
2
  template <class DT> void setValue(const DT & /*V*/) {}
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_111HelpPrinterELb1EE8setValueIbEEvRKT_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_118HelpPrinterWrapperELb1EE8setValueIbEEvRKT_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_114VersionPrinterELb1EE8setValueIbEEvRKT_
CommandLine.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_114VersionPrinterELb1EE8setValueIS3_EEvRKT_
Line
Count
Source
540
2
  template <class DT> void setValue(const DT & /*V*/) {}
CommandLine.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_111HelpPrinterELb1EE8setValueIS3_EEvRKT_
Line
Count
Source
540
4
  template <class DT> void setValue(const DT & /*V*/) {}
CommandLine.cpp:_ZN4llvm2cl15OptionValueBaseIN12_GLOBAL__N_118HelpPrinterWrapperELb1EE8setValueIS3_EEvRKT_
Line
Count
Source
540
4
  template <class DT> void setValue(const DT & /*V*/) {}
541
542
0
  bool compare(const DataType & /*V*/) const { return false; }
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_112DebugOnlyOptELb1EE7compareERKS3_
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_111HelpPrinterELb1EE7compareERKS3_
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_118HelpPrinterWrapperELb1EE7compareERKS3_
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_114VersionPrinterELb1EE7compareERKS3_
543
544
0
  bool compare(const GenericOptionValue & /*V*/) const override {
545
0
    return false;
546
0
  }
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_112DebugOnlyOptELb1EE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_111HelpPrinterELb1EE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_118HelpPrinterWrapperELb1EE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl15OptionValueBaseIN12_GLOBAL__N_114VersionPrinterELb1EE7compareERKNS0_18GenericOptionValueE
547
548
protected:
549
  ~OptionValueBase() = default;
550
};
551
552
// Simple copy of the option value.
553
template <class DataType> class OptionValueCopy : public GenericOptionValue {
554
  DataType Value;
555
  bool Valid = false;
556
557
protected:
558
0
  OptionValueCopy(const OptionValueCopy&) = default;
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIbEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIjEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIiEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIcEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEEC2ERKS3_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIlEC2ERKS2_
559
  OptionValueCopy &operator=(const OptionValueCopy &) = default;
560
0
  ~OptionValueCopy() = default;
561
562
public:
563
12
  OptionValueCopy() = default;
_ZN4llvm2cl15OptionValueCopyIbEC2Ev
Line
Count
Source
563
8
  OptionValueCopy() = default;
_ZN4llvm2cl15OptionValueCopyIjEC2Ev
Line
Count
Source
563
2
  OptionValueCopy() = default;
_ZN4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEEC2Ev
Line
Count
Source
563
2
  OptionValueCopy() = default;
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIlEC2Ev
564
565
0
  bool hasValue() const { return Valid; }
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIbE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIjE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIiE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIlE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIxE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyImE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIyE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIdE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIfE8hasValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIcE8hasValueEv
566
567
0
  const DataType &getValue() const {
568
0
    assert(Valid && "invalid option value");
569
0
    return Value;
570
0
  }
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIbE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIjE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIiE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIlE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIxE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyImE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIyE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIdE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIfE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIcE8getValueEv
571
572
20
  void setValue(const DataType &V) {
573
20
    Valid = true;
574
20
    Value = V;
575
20
  }
_ZN4llvm2cl15OptionValueCopyIbE8setValueERKb
Line
Count
Source
572
12
  void setValue(const DataType &V) {
573
12
    Valid = true;
574
12
    Value = V;
575
12
  }
_ZN4llvm2cl15OptionValueCopyIjE8setValueERKj
Line
Count
Source
572
4
  void setValue(const DataType &V) {
573
4
    Valid = true;
574
4
    Value = V;
575
4
  }
_ZN4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEE8setValueERKS2_
Line
Count
Source
572
4
  void setValue(const DataType &V) {
573
4
    Valid = true;
574
4
    Value = V;
575
4
  }
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE8setValueERKS7_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIiE8setValueERKi
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIcE8setValueERKc
Unexecuted instantiation: _ZN4llvm2cl15OptionValueCopyIlE8setValueERKl
576
577
0
  bool compare(const DataType &V) const { return Valid && (Value != V); }
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIbE7compareERKb
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIjE7compareERKj
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEE7compareERKS2_
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE7compareERKS7_
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIiE7compareERKi
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIcE7compareERKc
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIlE7compareERKl
578
579
0
  bool compare(const GenericOptionValue &V) const override {
580
0
    const OptionValueCopy<DataType> &VC =
581
0
        static_cast<const OptionValueCopy<DataType> &>(V);
582
0
    if (!VC.hasValue())
583
0
      return false;
584
0
    return compare(VC.getValue());
585
0
  }
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIbE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIjE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINS0_13boolOrDefaultEE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIiE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIcE7compareERKNS0_18GenericOptionValueE
Unexecuted instantiation: _ZNK4llvm2cl15OptionValueCopyIlE7compareERKNS0_18GenericOptionValueE
586
};
587
588
// Non-class option values.
589
template <class DataType>
590
struct OptionValueBase<DataType, false> : OptionValueCopy<DataType> {
591
  using WrapperType = DataType;
592
593
protected:
594
10
  OptionValueBase() = default;
_ZN4llvm2cl15OptionValueBaseIbLb0EEC2Ev
Line
Count
Source
594
8
  OptionValueBase() = default;
_ZN4llvm2cl15OptionValueBaseIjLb0EEC2Ev
Line
Count
Source
594
2
  OptionValueBase() = default;
Unexecuted instantiation: _ZN4llvm2cl15OptionValueBaseIlLb0EEC2Ev
595
0
  OptionValueBase(const OptionValueBase&) = default;
Unexecuted instantiation: _ZN4llvm2cl15OptionValueBaseIbLb0EEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueBaseIjLb0EEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueBaseIiLb0EEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueBaseIcLb0EEC2ERKS2_
Unexecuted instantiation: _ZN4llvm2cl15OptionValueBaseIlLb0EEC2ERKS2_
596
  OptionValueBase &operator=(const OptionValueBase &) = default;
597
  ~OptionValueBase() = default;
598
};
599
600
// Top-level option class.
601
template <class DataType>
602
struct OptionValue final
603
    : OptionValueBase<DataType, std::is_class<DataType>::value> {
604
16
  OptionValue() = default;
_ZN4llvm2cl11OptionValueIbEC2Ev
Line
Count
Source
604
4
  OptionValue() = default;
Debug.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_112DebugOnlyOptEEC2Ev
Line
Count
Source
604
2
  OptionValue() = default;
CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_111HelpPrinterEEC2Ev
Line
Count
Source
604
4
  OptionValue() = default;
CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_118HelpPrinterWrapperEEC2Ev
Line
Count
Source
604
4
  OptionValue() = default;
CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_114VersionPrinterEEC2Ev
Line
Count
Source
604
2
  OptionValue() = default;
605
606
6
  OptionValue(const DataType &V) { this->setValue(V); }
_ZN4llvm2cl11OptionValueIjEC2ERKj
Line
Count
Source
606
2
  OptionValue(const DataType &V) { this->setValue(V); }
_ZN4llvm2cl11OptionValueIbEC2ERKb
Line
Count
Source
606
4
  OptionValue(const DataType &V) { this->setValue(V); }
Unexecuted instantiation: _ZN4llvm2cl11OptionValueIlEC2ERKl
607
608
  // Some options may take their value from a different data type.
609
22
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
22
    this->setValue(V);
611
22
    return *this;
612
22
  }
_ZN4llvm2cl11OptionValueIbEaSIbEERS2_RKT_
Line
Count
Source
609
8
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
8
    this->setValue(V);
611
8
    return *this;
612
8
  }
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_112DebugOnlyOptEEaSINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERS4_RKT_
Debug.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_112DebugOnlyOptEEaSIS3_EERS4_RKT_
Line
Count
Source
609
2
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
2
    this->setValue(V);
611
2
    return *this;
612
2
  }
_ZN4llvm2cl11OptionValueIjEaSIjEERS2_RKT_
Line
Count
Source
609
2
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
2
    this->setValue(V);
611
2
    return *this;
612
2
  }
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_111HelpPrinterEEaSIbEERS4_RKT_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_118HelpPrinterWrapperEEaSIbEERS4_RKT_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_114VersionPrinterEEaSIbEERS4_RKT_
CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_114VersionPrinterEEaSIS3_EERS4_RKT_
Line
Count
Source
609
2
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
2
    this->setValue(V);
611
2
    return *this;
612
2
  }
Unexecuted instantiation: _ZN4llvm2cl11OptionValueIiEaSIiEERS2_RKT_
Unexecuted instantiation: _ZN4llvm2cl11OptionValueIcEaSIcEERS2_RKT_
CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_111HelpPrinterEEaSIS3_EERS4_RKT_
Line
Count
Source
609
4
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
4
    this->setValue(V);
611
4
    return *this;
612
4
  }
CommandLine.cpp:_ZN4llvm2cl11OptionValueIN12_GLOBAL__N_118HelpPrinterWrapperEEaSIS3_EERS4_RKT_
Line
Count
Source
609
4
  template <class DT> OptionValue<DataType> &operator=(const DT &V) {
610
4
    this->setValue(V);
611
4
    return *this;
612
4
  }
Unexecuted instantiation: _ZN4llvm2cl11OptionValueIlEaSIlEERS2_RKT_
613
};
614
615
// Other safe-to-copy-by-value common option types.
616
enum boolOrDefault { BOU_UNSET, BOU_TRUE, BOU_FALSE };
617
template <>
618
struct OptionValue<cl::boolOrDefault> final
619
    : OptionValueCopy<cl::boolOrDefault> {
620
  using WrapperType = cl::boolOrDefault;
621
622
  OptionValue() = default;
623
624
2
  OptionValue(const cl::boolOrDefault &V) { this->setValue(V); }
625
626
2
  OptionValue<cl::boolOrDefault> &operator=(const cl::boolOrDefault &V) {
627
2
    setValue(V);
628
2
    return *this;
629
2
  }
630
631
private:
632
  void anchor() override;
633
};
634
635
template <>
636
struct OptionValue<std::string> final : OptionValueCopy<std::string> {
637
  using WrapperType = StringRef;
638
639
  OptionValue() = default;
640
641
0
  OptionValue(const std::string &V) { this->setValue(V); }
642
643
0
  OptionValue<std::string> &operator=(const std::string &V) {
644
0
    setValue(V);
645
0
    return *this;
646
0
  }
647
648
private:
649
  void anchor() override;
650
};
651
652
//===----------------------------------------------------------------------===//
653
// Enum valued command line option
654
//
655
656
// This represents a single enum value, using "int" as the underlying type.
657
struct OptionEnumValue {
658
  StringRef Name;
659
  int Value;
660
  StringRef Description;
661
};
662
663
#define clEnumVal(ENUMVAL, DESC)                                               \
664
  llvm::cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
665
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)                                    \
666
  llvm::cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
667
668
// values - For custom data types, allow specifying a group of values together
669
// as the values that go into the mapping that the option handler uses.
670
//
671
class ValuesClass {
672
  // Use a vector instead of a map, because the lists should be short,
673
  // the overhead is less, and most importantly, it keeps them in the order
674
  // inserted so we can print our option out nicely.
675
  SmallVector<OptionEnumValue, 4> Values;
676
677
public:
678
  ValuesClass(std::initializer_list<OptionEnumValue> Options)
679
0
      : Values(Options) {}
680
681
  template <class Opt> void apply(Opt &O) const {
682
    for (auto Value : Values)
683
      O.getParser().addLiteralOption(Value.Name, Value.Value,
684
                                     Value.Description);
685
  }
686
};
687
688
/// Helper to build a ValuesClass by forwarding a variable number of arguments
689
/// as an initializer list to the ValuesClass constructor.
690
template <typename... OptsTy> ValuesClass values(OptsTy... Options) {
691
  return ValuesClass({Options...});
692
}
693
694
//===----------------------------------------------------------------------===//
695
// parser class - Parameterizable parser for different data types.  By default,
696
// known data types (string, int, bool) have specialized parsers, that do what
697
// you would expect.  The default parser, used for data types that are not
698
// built-in, uses a mapping table to map specific options to values, which is
699
// used, among other things, to handle enum types.
700
701
//--------------------------------------------------
702
// generic_parser_base - This class holds all the non-generic code that we do
703
// not need replicated for every instance of the generic parser.  This also
704
// allows us to put stuff into CommandLine.cpp
705
//
706
class generic_parser_base {
707
protected:
708
  class GenericOptionInfo {
709
  public:
710
    GenericOptionInfo(StringRef name, StringRef helpStr)
711
0
        : Name(name), HelpStr(helpStr) {}
712
    StringRef Name;
713
    StringRef HelpStr;
714
  };
715
716
public:
717
0
  generic_parser_base(Option &O) : Owner(O) {}
718
719
0
  virtual ~generic_parser_base() = default;
720
  // Base class should have virtual-destructor
721
722
  // getNumOptions - Virtual function implemented by generic subclass to
723
  // indicate how many entries are in Values.
724
  //
725
  virtual unsigned getNumOptions() const = 0;
726
727
  // getOption - Return option name N.
728
  virtual StringRef getOption(unsigned N) const = 0;
729
730
  // getDescription - Return description N
731
  virtual StringRef getDescription(unsigned N) const = 0;
732
733
  // Return the width of the option tag for printing...
734
  virtual size_t getOptionWidth(const Option &O) const;
735
736
  virtual const GenericOptionValue &getOptionValue(unsigned N) const = 0;
737
738
  // printOptionInfo - Print out information about this option.  The
739
  // to-be-maintained width is specified.
740
  //
741
  virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const;
742
743
  void printGenericOptionDiff(const Option &O, const GenericOptionValue &V,
744
                              const GenericOptionValue &Default,
745
                              size_t GlobalWidth) const;
746
747
  // printOptionDiff - print the value of an option and it's default.
748
  //
749
  // Template definition ensures that the option and default have the same
750
  // DataType (via the same AnyOptionValue).
751
  template <class AnyOptionValue>
752
  void printOptionDiff(const Option &O, const AnyOptionValue &V,
753
                       const AnyOptionValue &Default,
754
                       size_t GlobalWidth) const {
755
    printGenericOptionDiff(O, V, Default, GlobalWidth);
756
  }
757
758
0
  void initialize() {}
759
760
0
  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) {
761
0
    // If there has been no argstr specified, that means that we need to add an
762
0
    // argument for every possible option.  This ensures that our options are
763
0
    // vectored to us.
764
0
    if (!Owner.hasArgStr())
765
0
      for (unsigned i = 0, e = getNumOptions(); i != e; ++i)
766
0
        OptionNames.push_back(getOption(i));
767
0
  }
768
769
0
  enum ValueExpected getValueExpectedFlagDefault() const {
770
0
    // If there is an ArgStr specified, then we are of the form:
771
0
    //
772
0
    //    -opt=O2   or   -opt O2  or  -optO2
773
0
    //
774
0
    // In which case, the value is required.  Otherwise if an arg str has not
775
0
    // been specified, we are of the form:
776
0
    //
777
0
    //    -O2 or O2 or -la (where -l and -a are separate options)
778
0
    //
779
0
    // If this is the case, we cannot allow a value.
780
0
    //
781
0
    if (Owner.hasArgStr())
782
0
      return ValueRequired;
783
0
    else
784
0
      return ValueDisallowed;
785
0
  }
786
787
  // findOption - Return the option number corresponding to the specified
788
  // argument string.  If the option is not found, getNumOptions() is returned.
789
  //
790
  unsigned findOption(StringRef Name);
791
792
protected:
793
  Option &Owner;
794
};
795
796
// Default parser implementation - This implementation depends on having a
797
// mapping of recognized options to values of some sort.  In addition to this,
798
// each entry in the mapping also tracks a help message that is printed with the
799
// command line option for -help.  Because this is a simple mapping parser, the
800
// data type can be any unsupported type.
801
//
802
template <class DataType> class parser : public generic_parser_base {
803
protected:
804
  class OptionInfo : public GenericOptionInfo {
805
  public:
806
    OptionInfo(StringRef name, DataType v, StringRef helpStr)
807
        : GenericOptionInfo(name, helpStr), V(v) {}
808
809
    OptionValue<DataType> V;
810
  };
811
  SmallVector<OptionInfo, 8> Values;
812
813
public:
814
  parser(Option &O) : generic_parser_base(O) {}
815
816
  using parser_data_type = DataType;
817
818
  // Implement virtual functions needed by generic_parser_base
819
  unsigned getNumOptions() const override { return unsigned(Values.size()); }
820
  StringRef getOption(unsigned N) const override { return Values[N].Name; }
821
  StringRef getDescription(unsigned N) const override {
822
    return Values[N].HelpStr;
823
  }
824
825
  // getOptionValue - Return the value of option name N.
826
  const GenericOptionValue &getOptionValue(unsigned N) const override {
827
    return Values[N].V;
828
  }
829
830
  // parse - Return true on error.
831
  bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V) {
832
    StringRef ArgVal;
833
    if (Owner.hasArgStr())
834
      ArgVal = Arg;
835
    else
836
      ArgVal = ArgName;
837
838
    for (size_t i = 0, e = Values.size(); i != e; ++i)
839
      if (Values[i].Name == ArgVal) {
840
        V = Values[i].V.getValue();
841
        return false;
842
      }
843
844
    return O.error("Cannot find option named '" + ArgVal + "'!");
845
  }
846
847
  /// addLiteralOption - Add an entry to the mapping table.
848
  ///
849
  template <class DT>
850
  void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr) {
851
    assert(findOption(Name) == Values.size() && "Option already exists!");
852
    OptionInfo X(Name, static_cast<DataType>(V), HelpStr);
853
    Values.push_back(X);
854
    AddLiteralOption(Owner, Name);
855
  }
856
857
  /// removeLiteralOption - Remove the specified option.
858
  ///
859
  void removeLiteralOption(StringRef Name) {
860
    unsigned N = findOption(Name);
861
    assert(N != Values.size() && "Option not found!");
862
    Values.erase(Values.begin() + N);
863
  }
864
};
865
866
//--------------------------------------------------
867
// basic_parser - Super class of parsers to provide boilerplate code
868
//
869
class basic_parser_impl { // non-template implementation of basic_parser<t>
870
public:
871
24
  basic_parser_impl(Option &) {}
872
873
0
  virtual ~basic_parser_impl() {}
874
875
0
  enum ValueExpected getValueExpectedFlagDefault() const {
876
0
    return ValueRequired;
877
0
  }
878
879
0
  void getExtraOptionNames(SmallVectorImpl<StringRef> &) {}
880
881
6
  void initialize() {}
882
883
  // Return the width of the option tag for printing...
884
  size_t getOptionWidth(const Option &O) const;
885
886
  // printOptionInfo - Print out information about this option.  The
887
  // to-be-maintained width is specified.
888
  //
889
  void printOptionInfo(const Option &O, size_t GlobalWidth) const;
890
891
  // printOptionNoValue - Print a placeholder for options that don't yet support
892
  // printOptionDiff().
893
  void printOptionNoValue(const Option &O, size_t GlobalWidth) const;
894
895
  // getValueName - Overload in subclass to provide a better default value.
896
0
  virtual StringRef getValueName() const { return "value"; }
897
898
  // An out-of-line virtual method to provide a 'home' for this class.
899
  virtual void anchor();
900
901
protected:
902
  // A helper for basic_parser::printOptionDiff.
903
  void printOptionName(const Option &O, size_t GlobalWidth) const;
904
};
905
906
// basic_parser - The real basic parser is just a template wrapper that provides
907
// a typedef for the provided data type.
908
//
909
template <class DataType> class basic_parser : public basic_parser_impl {
910
public:
911
  using parser_data_type = DataType;
912
  using OptVal = OptionValue<DataType>;
913
914
24
  basic_parser(Option &O) : basic_parser_impl(O) {}
_ZN4llvm2cl12basic_parserIbEC2ERNS0_6OptionE
Line
Count
Source
914
18
  basic_parser(Option &O) : basic_parser_impl(O) {}
_ZN4llvm2cl12basic_parserINS0_13boolOrDefaultEEC2ERNS0_6OptionE
Line
Count
Source
914
2
  basic_parser(Option &O) : basic_parser_impl(O) {}
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIiEC2ERNS0_6OptionE
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIlEC2ERNS0_6OptionE
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIxEC2ERNS0_6OptionE
_ZN4llvm2cl12basic_parserIjEC2ERNS0_6OptionE
Line
Count
Source
914
2
  basic_parser(Option &O) : basic_parser_impl(O) {}
Unexecuted instantiation: _ZN4llvm2cl12basic_parserImEC2ERNS0_6OptionE
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIyEC2ERNS0_6OptionE
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIdEC2ERNS0_6OptionE
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIfEC2ERNS0_6OptionE
_ZN4llvm2cl12basic_parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEC2ERNS0_6OptionE
Line
Count
Source
914
2
  basic_parser(Option &O) : basic_parser_impl(O) {}
Unexecuted instantiation: _ZN4llvm2cl12basic_parserIcEC2ERNS0_6OptionE
915
};
916
917
//--------------------------------------------------
918
// parser<bool>
919
//
920
template <> class parser<bool> : public basic_parser<bool> {
921
public:
922
18
  parser(Option &O) : basic_parser(O) {}
923
924
  // parse - Return true on error.
925
  bool parse(Option &O, StringRef ArgName, StringRef Arg, bool &Val);
926
927
18
  void initialize() {}
928
929
0
  enum ValueExpected getValueExpectedFlagDefault() const {
930
0
    return ValueOptional;
931
0
  }
932
933
  // getValueName - Do not print =<value> at all.
934
0
  StringRef getValueName() const override { return StringRef(); }
935
936
  void printOptionDiff(const Option &O, bool V, OptVal Default,
937
                       size_t GlobalWidth) const;
938
939
  // An out-of-line virtual method to provide a 'home' for this class.
940
  void anchor() override;
941
};
942
943
extern template class basic_parser<bool>;
944
945
//--------------------------------------------------
946
// parser<boolOrDefault>
947
template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
948
public:
949
2
  parser(Option &O) : basic_parser(O) {}
950
951
  // parse - Return true on error.
952
  bool parse(Option &O, StringRef ArgName, StringRef Arg, boolOrDefault &Val);
953
954
0
  enum ValueExpected getValueExpectedFlagDefault() const {
955
0
    return ValueOptional;
956
0
  }
957
958
  // getValueName - Do not print =<value> at all.
959
0
  StringRef getValueName() const override { return StringRef(); }
960
961
  void printOptionDiff(const Option &O, boolOrDefault V, OptVal Default,
962
                       size_t GlobalWidth) const;
963
964
  // An out-of-line virtual method to provide a 'home' for this class.
965
  void anchor() override;
966
};
967
968
extern template class basic_parser<boolOrDefault>;
969
970
//--------------------------------------------------
971
// parser<int>
972
//
973
template <> class parser<int> : public basic_parser<int> {
974
public:
975
0
  parser(Option &O) : basic_parser(O) {}
976
977
  // parse - Return true on error.
978
  bool parse(Option &O, StringRef ArgName, StringRef Arg, int &Val);
979
980
  // getValueName - Overload in subclass to provide a better default value.
981
0
  StringRef getValueName() const override { return "int"; }
982
983
  void printOptionDiff(const Option &O, int V, OptVal Default,
984
                       size_t GlobalWidth) const;
985
986
  // An out-of-line virtual method to provide a 'home' for this class.
987
  void anchor() override;
988
};
989
990
extern template class basic_parser<int>;
991
992
//--------------------------------------------------
993
// parser<long>
994
//
995
template <> class parser<long> final : public basic_parser<long> {
996
public:
997
0
  parser(Option &O) : basic_parser(O) {}
998
999
  // parse - Return true on error.
1000
  bool parse(Option &O, StringRef ArgName, StringRef Arg, long &Val);
1001
1002
  // getValueName - Overload in subclass to provide a better default value.
1003
0
  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
extern template class basic_parser<long>;
1013
1014
//--------------------------------------------------
1015
// parser<long long>
1016
//
1017
template <> class parser<long long> : public basic_parser<long long> {
1018
public:
1019
0
  parser(Option &O) : basic_parser(O) {}
1020
1021
  // parse - Return true on error.
1022
  bool parse(Option &O, StringRef ArgName, StringRef Arg, long long &Val);
1023
1024
  // getValueName - Overload in subclass to provide a better default value.
1025
0
  StringRef getValueName() const override { return "long"; }
1026
1027
  void printOptionDiff(const Option &O, long long V, OptVal Default,
1028
                       size_t GlobalWidth) const;
1029
1030
  // An out-of-line virtual method to provide a 'home' for this class.
1031
  void anchor() override;
1032
};
1033
1034
extern template class basic_parser<long long>;
1035
1036
//--------------------------------------------------
1037
// parser<unsigned>
1038
//
1039
template <> class parser<unsigned> : public basic_parser<unsigned> {
1040
public:
1041
2
  parser(Option &O) : basic_parser(O) {}
1042
1043
  // parse - Return true on error.
1044
  bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned &Val);
1045
1046
  // getValueName - Overload in subclass to provide a better default value.
1047
0
  StringRef getValueName() const override { return "uint"; }
1048
1049
  void printOptionDiff(const Option &O, unsigned V, OptVal Default,
1050
                       size_t GlobalWidth) const;
1051
1052
  // An out-of-line virtual method to provide a 'home' for this class.
1053
  void anchor() override;
1054
};
1055
1056
extern template class basic_parser<unsigned>;
1057
1058
//--------------------------------------------------
1059
// parser<unsigned long>
1060
//
1061
template <>
1062
class parser<unsigned long> final : public basic_parser<unsigned long> {
1063
public:
1064
0
  parser(Option &O) : basic_parser(O) {}
1065
1066
  // parse - Return true on error.
1067
  bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long &Val);
1068
1069
  // getValueName - Overload in subclass to provide a better default value.
1070
0
  StringRef getValueName() const override { return "ulong"; }
1071
1072
  void printOptionDiff(const Option &O, unsigned long V, OptVal Default,
1073
                       size_t GlobalWidth) const;
1074
1075
  // An out-of-line virtual method to provide a 'home' for this class.
1076
  void anchor() override;
1077
};
1078
1079
extern template class basic_parser<unsigned long>;
1080
1081
//--------------------------------------------------
1082
// parser<unsigned long long>
1083
//
1084
template <>
1085
class parser<unsigned long long> : public basic_parser<unsigned long long> {
1086
public:
1087
0
  parser(Option &O) : basic_parser(O) {}
1088
1089
  // parse - Return true on error.
1090
  bool parse(Option &O, StringRef ArgName, StringRef Arg,
1091
             unsigned long long &Val);
1092
1093
  // getValueName - Overload in subclass to provide a better default value.
1094
0
  StringRef getValueName() const override { return "ulong"; }
1095
1096
  void printOptionDiff(const Option &O, unsigned long long V, OptVal Default,
1097
                       size_t GlobalWidth) const;
1098
1099
  // An out-of-line virtual method to provide a 'home' for this class.
1100
  void anchor() override;
1101
};
1102
1103
extern template class basic_parser<unsigned long long>;
1104
1105
//--------------------------------------------------
1106
// parser<double>
1107
//
1108
template <> class parser<double> : public basic_parser<double> {
1109
public:
1110
0
  parser(Option &O) : basic_parser(O) {}
1111
1112
  // parse - Return true on error.
1113
  bool parse(Option &O, StringRef ArgName, StringRef Arg, double &Val);
1114
1115
  // getValueName - Overload in subclass to provide a better default value.
1116
0
  StringRef getValueName() const override { return "number"; }
1117
1118
  void printOptionDiff(const Option &O, double V, OptVal Default,
1119
                       size_t GlobalWidth) const;
1120
1121
  // An out-of-line virtual method to provide a 'home' for this class.
1122
  void anchor() override;
1123
};
1124
1125
extern template class basic_parser<double>;
1126
1127
//--------------------------------------------------
1128
// parser<float>
1129
//
1130
template <> class parser<float> : public basic_parser<float> {
1131
public:
1132
0
  parser(Option &O) : basic_parser(O) {}
1133
1134
  // parse - Return true on error.
1135
  bool parse(Option &O, StringRef ArgName, StringRef Arg, float &Val);
1136
1137
  // getValueName - Overload in subclass to provide a better default value.
1138
0
  StringRef getValueName() const override { return "number"; }
1139
1140
  void printOptionDiff(const Option &O, float V, OptVal Default,
1141
                       size_t GlobalWidth) const;
1142
1143
  // An out-of-line virtual method to provide a 'home' for this class.
1144
  void anchor() override;
1145
};
1146
1147
extern template class basic_parser<float>;
1148
1149
//--------------------------------------------------
1150
// parser<std::string>
1151
//
1152
template <> class parser<std::string> : public basic_parser<std::string> {
1153
public:
1154
2
  parser(Option &O) : basic_parser(O) {}
1155
1156
  // parse - Return true on error.
1157
0
  bool parse(Option &, StringRef, StringRef Arg, std::string &Value) {
1158
0
    Value = Arg.str();
1159
0
    return false;
1160
0
  }
1161
1162
  // getValueName - Overload in subclass to provide a better default value.
1163
0
  StringRef getValueName() const override { return "string"; }
1164
1165
  void printOptionDiff(const Option &O, StringRef V, const OptVal &Default,
1166
                       size_t GlobalWidth) const;
1167
1168
  // An out-of-line virtual method to provide a 'home' for this class.
1169
  void anchor() override;
1170
};
1171
1172
extern template class basic_parser<std::string>;
1173
1174
//--------------------------------------------------
1175
// parser<char>
1176
//
1177
template <> class parser<char> : public basic_parser<char> {
1178
public:
1179
0
  parser(Option &O) : basic_parser(O) {}
1180
1181
  // parse - Return true on error.
1182
0
  bool parse(Option &, StringRef, StringRef Arg, char &Value) {
1183
0
    Value = Arg[0];
1184
0
    return false;
1185
0
  }
1186
1187
  // getValueName - Overload in subclass to provide a better default value.
1188
0
  StringRef getValueName() const override { return "char"; }
1189
1190
  void printOptionDiff(const Option &O, char V, OptVal Default,
1191
                       size_t GlobalWidth) const;
1192
1193
  // An out-of-line virtual method to provide a 'home' for this class.
1194
  void anchor() override;
1195
};
1196
1197
extern template class basic_parser<char>;
1198
1199
//--------------------------------------------------
1200
// PrintOptionDiff
1201
//
1202
// This collection of wrappers is the intermediary between class opt and class
1203
// parser to handle all the template nastiness.
1204
1205
// This overloaded function is selected by the generic parser.
1206
template <class ParserClass, class DT>
1207
void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V,
1208
                     const OptionValue<DT> &Default, size_t GlobalWidth) {
1209
  OptionValue<DT> OV = V;
1210
  P.printOptionDiff(O, OV, Default, GlobalWidth);
1211
}
1212
1213
// This is instantiated for basic parsers when the parsed value has a different
1214
// type than the option value. e.g. HelpPrinter.
1215
template <class ParserDT, class ValDT> struct OptionDiffPrinter {
1216
  void print(const Option &O, const parser<ParserDT> &P, const ValDT & /*V*/,
1217
0
             const OptionValue<ValDT> & /*Default*/, size_t GlobalWidth) {
1218
0
    P.printOptionNoValue(O, GlobalWidth);
1219
0
  }
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl17OptionDiffPrinterINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN12_GLOBAL__N_112DebugOnlyOptEE5printERKNS0_6OptionERKNS0_6parserIS7_EERKS9_RKNS0_11OptionValueIS9_EEm
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl17OptionDiffPrinterIbN12_GLOBAL__N_111HelpPrinterEE5printERKNS0_6OptionERKNS0_6parserIbEERKS3_RKNS0_11OptionValueIS3_EEm
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl17OptionDiffPrinterIbN12_GLOBAL__N_118HelpPrinterWrapperEE5printERKNS0_6OptionERKNS0_6parserIbEERKS3_RKNS0_11OptionValueIS3_EEm
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl17OptionDiffPrinterIbN12_GLOBAL__N_114VersionPrinterEE5printERKNS0_6OptionERKNS0_6parserIbEERKS3_RKNS0_11OptionValueIS3_EEm
1220
};
1221
1222
// This is instantiated for basic parsers when the parsed value has the same
1223
// type as the option value.
1224
template <class DT> struct OptionDiffPrinter<DT, DT> {
1225
  void print(const Option &O, const parser<DT> &P, const DT &V,
1226
0
             const OptionValue<DT> &Default, size_t GlobalWidth) {
1227
0
    P.printOptionDiff(O, V, Default, GlobalWidth);
1228
0
  }
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterIbbE5printERKNS0_6OptionERKNS0_6parserIbEERKbRKNS0_11OptionValueIbEEm
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterIjjE5printERKNS0_6OptionERKNS0_6parserIjEERKjRKNS0_11OptionValueIjEEm
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterIiiE5printERKNS0_6OptionERKNS0_6parserIiEERKiRKNS0_11OptionValueIiEEm
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_E5printERKNS0_6OptionERKNS0_6parserIS7_EERKS7_RKNS0_11OptionValueIS7_EEm
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterIccE5printERKNS0_6OptionERKNS0_6parserIcEERKcRKNS0_11OptionValueIcEEm
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterINS0_13boolOrDefaultES2_E5printERKNS0_6OptionERKNS0_6parserIS2_EERKS2_RKNS0_11OptionValueIS2_EEm
Unexecuted instantiation: _ZN4llvm2cl17OptionDiffPrinterIllE5printERKNS0_6OptionERKNS0_6parserIlEERKlRKNS0_11OptionValueIlEEm
1229
};
1230
1231
// This overloaded function is selected by the basic parser, which may parse a
1232
// different type than the option type.
1233
template <class ParserClass, class ValDT>
1234
void printOptionDiff(
1235
    const Option &O,
1236
    const basic_parser<typename ParserClass::parser_data_type> &P,
1237
0
    const ValDT &V, const OptionValue<ValDT> &Default, size_t GlobalWidth) {
1238
0
1239
0
  OptionDiffPrinter<typename ParserClass::parser_data_type, ValDT> printer;
1240
0
  printer.print(O, static_cast<const ParserClass &>(P), V, Default,
1241
0
                GlobalWidth);
1242
0
}
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserIbEEbEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISD_EEm
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl15printOptionDiffINS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEN12_GLOBAL__N_112DebugOnlyOptEEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISL_EEm
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl15printOptionDiffINS0_6parserIbEEN12_GLOBAL__N_111HelpPrinterEEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISF_EEm
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl15printOptionDiffINS0_6parserIbEEN12_GLOBAL__N_118HelpPrinterWrapperEEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISF_EEm
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl15printOptionDiffINS0_6parserIbEEN12_GLOBAL__N_114VersionPrinterEEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISF_EEm
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserIjEEjEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISD_EEm
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserIiEEiEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISD_EEm
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEES8_EEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISJ_EEm
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserIcEEcEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISD_EEm
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserINS0_13boolOrDefaultEEES3_EEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISE_EEm
Unexecuted instantiation: _ZN4llvm2cl15printOptionDiffINS0_6parserIlEElEEvRKNS0_6OptionERKNS0_12basic_parserINT_16parser_data_typeEEERKT0_RKNS0_11OptionValueISD_EEm
1243
1244
//===----------------------------------------------------------------------===//
1245
// applicator class - This class is used because we must use partial
1246
// specialization to handle literal string arguments specially (const char* does
1247
// not correctly respond to the apply method).  Because the syntax to use this
1248
// is a pain, we have the 'apply' method below to handle the nastiness...
1249
//
1250
template <class Mod> struct applicator {
1251
82
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIbLb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_13LocationClassIbEEE3optINS0_3optIbLb1ENS0_6parserIbEEEEEEvRKS3_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIjLb0ENS0_6parserIjEEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_11initializerIiEEE3optINS0_3optIjLb0ENS0_6parserIjEEEEEEvRKS3_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
Debug.cpp:_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
Debug.cpp:_ZN4llvm2cl10applicatorINS0_10value_descEE3optINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
Debug.cpp:_ZN4llvm2cl10applicatorINS0_13LocationClassIN12_GLOBAL__N_112DebugOnlyOptEEEE3optINS0_3optIS4_Lb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEEEEvRKS5_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_13LocationClassIN12_GLOBAL__N_111HelpPrinterEEEE3optINS0_3optIS4_Lb1ENS0_6parserIbEEEEEEvRKS5_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_3catEE3optINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_3subEE3optINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_13LocationClassIN12_GLOBAL__N_118HelpPrinterWrapperEEEE3optINS0_3optIS4_Lb1ENS0_6parserIbEEEEEEvRKS5_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_3catEE3optINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_3subEE3optINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_5aliasEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_8aliasoptEE3optINS0_5aliasEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_11initializerIbEEE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvRKS3_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_3catEE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_3subEE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
4
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_13LocationClassIN12_GLOBAL__N_114VersionPrinterEEEE3optINS0_3optIS4_Lb1ENS0_6parserIbEEEEEEvRKS5_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
CommandLine.cpp:_ZN4llvm2cl10applicatorINS0_3catEE3optINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_3catEE3optINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS6_EEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS6_EEEEEEvRKS2_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
_ZN4llvm2cl10applicatorINS0_11initializerINS0_13boolOrDefaultEEEE3optINS0_3optIS3_Lb0ENS0_6parserIS3_EEEEEEvRKS4_RT_
Line
Count
Source
1251
2
  template <class Opt> static void opt(const Mod &M, Opt &O) { M.apply(O); }
Unexecuted instantiation: _ZN4llvm2cl10applicatorINS0_4descEE3optINS0_3optIlLb0ENS0_6parserIlEEEEEEvRKS2_RT_
1252
};
1253
1254
// Handle const char* as a special case...
1255
template <unsigned n> struct applicator<char[n]> {
1256
26
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
26
    O.setArgStr(Str);
1258
26
  }
_ZN4llvm2cl10applicatorIA6_cE3optINS0_3optIbLb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
_ZN4llvm2cl10applicatorIA18_cE3optINS0_3optIjLb0ENS0_6parserIjEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
Debug.cpp:_ZN4llvm2cl10applicatorIA11_cE3optINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
CommandLine.cpp:_ZN4llvm2cl10applicatorIA10_cE3optINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
CommandLine.cpp:_ZN4llvm2cl10applicatorIA17_cE3optINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
CommandLine.cpp:_ZN4llvm2cl10applicatorIA5_cE3optINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
_ZN4llvm2cl10applicatorIA2_cE3optINS0_5aliasEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
CommandLine.cpp:_ZN4llvm2cl10applicatorIA12_cE3optINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
_ZN4llvm2cl10applicatorIA14_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
_ZN4llvm2cl10applicatorIA18_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
CommandLine.cpp:_ZN4llvm2cl10applicatorIA8_cE3optINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
_ZN4llvm2cl10applicatorIA6_cE3optINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS6_EEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
_ZN4llvm2cl10applicatorIA22_cE3optINS0_3optIbLb1ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Line
Count
Source
1256
2
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1257
2
    O.setArgStr(Str);
1258
2
  }
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA44_cE3optINS0_3optIlLb0ENS0_6parserIlEEEEEEvNS_9StringRefERT_
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA35_cE3optINS0_3optIjLb0ENS0_6parserIjEEEEEEvNS_9StringRefERT_
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA21_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA22_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA23_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA28_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
Unexecuted instantiation: _ZN4llvm2cl10applicatorIA36_cE3optINS0_3optIbLb0ENS0_6parserIbEEEEEEvNS_9StringRefERT_
1259
};
1260
template <unsigned n> struct applicator<const char[n]> {
1261
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1262
    O.setArgStr(Str);
1263
  }
1264
};
1265
template <> struct applicator<StringRef > {
1266
  template <class Opt> static void opt(StringRef Str, Opt &O) {
1267
    O.setArgStr(Str);
1268
  }
1269
};
1270
1271
template <> struct applicator<NumOccurrencesFlag> {
1272
2
  static void opt(NumOccurrencesFlag N, Option &O) {
1273
2
    O.setNumOccurrencesFlag(N);
1274
2
  }
1275
};
1276
1277
template <> struct applicator<ValueExpected> {
1278
12
  static void opt(ValueExpected VE, Option &O) { O.setValueExpectedFlag(VE); }
1279
};
1280
1281
template <> struct applicator<OptionHidden> {
1282
18
  static void opt(OptionHidden OH, Option &O) { O.setHiddenFlag(OH); }
1283
};
1284
1285
template <> struct applicator<FormattingFlags> {
1286
0
  static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
1287
};
1288
1289
template <> struct applicator<MiscFlags> {
1290
2
  static void opt(MiscFlags MF, Option &O) {
1291
2
    assert((MF != Grouping || O.ArgStr.size() == 1) &&
1292
2
           "cl::Grouping can only apply to single charater Options.");
1293
2
    O.setMiscFlag(MF);
1294
2
  }
1295
};
1296
1297
// apply method - Apply modifiers to an option in a type safe way.
1298
template <class Opt, class Mod, class... Mods>
1299
116
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
116
  applicator<Mod>::opt(M, *O);
1301
116
  apply(O, Ms...);
1302
116
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEEA6_cJNS0_4descENS0_12OptionHiddenENS0_13LocationClassIbEEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEENS0_4descEJNS0_12OptionHiddenENS0_13LocationClassIbEEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEENS0_12OptionHiddenEJNS0_13LocationClassIbEEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIjLb0ENS0_6parserIjEEEEA18_cJNS0_4descENS0_12OptionHiddenENS0_11initializerIiEEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIjLb0ENS0_6parserIjEEEENS0_4descEJNS0_12OptionHiddenENS0_11initializerIiEEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIjLb0ENS0_6parserIjEEEENS0_12OptionHiddenEJNS0_11initializerIiEEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEEA11_cJNS0_4descENS0_12OptionHiddenENS0_18NumOccurrencesFlagENS0_10value_descENS0_13LocationClassIS4_EENS0_13ValueExpectedEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_4descEJNS0_12OptionHiddenENS0_18NumOccurrencesFlagENS0_10value_descENS0_13LocationClassIS4_EENS0_13ValueExpectedEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_12OptionHiddenEJNS0_18NumOccurrencesFlagENS0_10value_descENS0_13LocationClassIS4_EENS0_13ValueExpectedEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_18NumOccurrencesFlagEJNS0_10value_descENS0_13LocationClassIS4_EENS0_13ValueExpectedEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_10value_descEJNS0_13LocationClassIS4_EENS0_13ValueExpectedEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_13LocationClassIS4_EEJNS0_13ValueExpectedEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEA10_cJNS0_4descENS0_13LocationClassIS4_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEENS0_4descEJNS0_13LocationClassIS4_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEENS0_13LocationClassIS4_EEJNS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEENS0_12OptionHiddenEJNS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEENS0_13ValueExpectedEJNS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEENS0_3catEJNS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEEA17_cJNS0_4descENS0_13LocationClassIS4_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEA5_cJNS0_4descENS0_13LocationClassIS4_EENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_4descEJNS0_13LocationClassIS4_EENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_13LocationClassIS4_EEJNS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_13ValueExpectedEJNS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_3catEJNS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
_ZN4llvm2cl5applyINS0_5aliasEA2_cJNS0_4descENS0_8aliasoptENS0_9MiscFlagsEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_5aliasENS0_4descEJNS0_8aliasoptENS0_9MiscFlagsEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_5aliasENS0_8aliasoptEJNS0_9MiscFlagsEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEEA12_cJNS0_4descENS0_13LocationClassIS4_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_4descEJNS0_13LocationClassIS4_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_13LocationClassIS4_EEJNS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_12OptionHiddenEJNS0_13ValueExpectedENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA14_cJNS0_4descENS0_12OptionHiddenENS0_11initializerIbEENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_4descEJNS0_12OptionHiddenENS0_11initializerIbEENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_12OptionHiddenEJNS0_11initializerIbEENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_11initializerIbEEJNS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_3catEJNS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
4
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
4
  applicator<Mod>::opt(M, *O);
1301
4
  apply(O, Ms...);
1302
4
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA18_cJNS0_4descENS0_12OptionHiddenENS0_11initializerIbEENS0_3catENS0_3subEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEEA8_cJNS0_4descENS0_13LocationClassIS4_EENS0_13ValueExpectedENS0_3catEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEENS0_4descEJNS0_13LocationClassIS4_EENS0_13ValueExpectedENS0_3catEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEENS0_13LocationClassIS4_EEJNS0_13ValueExpectedENS0_3catEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEENS0_13ValueExpectedEJNS0_3catEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS3_EEEEA6_cJNS0_3catENS0_4descENS0_11initializerIS3_EEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS3_EEEENS0_3catEJNS0_4descENS0_11initializerIS3_EEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS3_EEEENS0_4descEJNS0_11initializerIS3_EEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEEA22_cJNS0_4descENS0_13LocationClassIbEENS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEENS0_4descEJNS0_13LocationClassIbEENS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEENS0_13LocationClassIbEEJNS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Line
Count
Source
1299
2
void apply(Opt *O, const Mod &M, const Mods &... Ms) {
1300
2
  applicator<Mod>::opt(M, *O);
1301
2
  apply(O, Ms...);
1302
2
}
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIlLb0ENS0_6parserIlEEEEA44_cJNS0_4descEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIjLb0ENS0_6parserIjEEEEA35_cJNS0_4descEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA21_cJNS0_11initializerIbEENS0_4descEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_11initializerIbEEJNS0_4descEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA22_cJNS0_11initializerIbEENS0_4descEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA22_cJNS0_11initializerIbEENS0_4descENS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_11initializerIbEEJNS0_4descENS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_4descEJNS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA23_cJNS0_11initializerIbEENS0_4descENS0_12OptionHiddenEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA23_cJNS0_4descEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA28_cJNS0_4descENS0_11initializerIbEEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_4descEJNS0_11initializerIbEEEEEvPT_RKT0_DpRKT1_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEEA36_cJNS0_4descEEEEvPT_RKT0_DpRKT1_
1303
1304
26
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
26
  applicator<Mod>::opt(M, *O);
1306
26
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEENS0_13LocationClassIbEEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
_ZN4llvm2cl5applyINS0_3optIjLb0ENS0_6parserIjEEEENS0_11initializerIiEEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
Debug.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEENS0_13ValueExpectedEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEENS0_3subEEEvPT_RKT0_
Line
Count
Source
1304
4
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
4
  applicator<Mod>::opt(M, *O);
1306
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEENS0_3subEEEvPT_RKT0_
Line
Count
Source
1304
4
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
4
  applicator<Mod>::opt(M, *O);
1306
4
}
_ZN4llvm2cl5applyINS0_5aliasENS0_9MiscFlagsEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
_ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_3subEEEvPT_RKT0_
Line
Count
Source
1304
4
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
4
  applicator<Mod>::opt(M, *O);
1306
4
}
CommandLine.cpp:_ZN4llvm2cl5applyINS0_3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEENS0_3catEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
_ZN4llvm2cl5applyINS0_3optINS0_13boolOrDefaultELb0ENS0_6parserIS3_EEEENS0_11initializerIS3_EEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
_ZN4llvm2cl5applyINS0_3optIbLb1ENS0_6parserIbEEEENS0_12OptionHiddenEEEvPT_RKT0_
Line
Count
Source
1304
2
template <class Opt, class Mod> void apply(Opt *O, const Mod &M) {
1305
2
  applicator<Mod>::opt(M, *O);
1306
2
}
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIlLb0ENS0_6parserIlEEEENS0_4descEEEvPT_RKT0_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIjLb0ENS0_6parserIjEEEENS0_4descEEEvPT_RKT0_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_4descEEEvPT_RKT0_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_12OptionHiddenEEEvPT_RKT0_
Unexecuted instantiation: _ZN4llvm2cl5applyINS0_3optIbLb0ENS0_6parserIbEEEENS0_11initializerIbEEEEvPT_RKT0_
1307
1308
//===----------------------------------------------------------------------===//
1309
// opt_storage class
1310
1311
// Default storage class definition: external storage.  This implementation
1312
// assumes the user will specify a variable to store the data into with the
1313
// cl::location(x) modifier.
1314
//
1315
template <class DataType, bool ExternalStorage, bool isClass>
1316
class opt_storage {
1317
  DataType *Location = nullptr; // Where to store the object...
1318
  OptionValue<DataType> Default;
1319
1320
0
  void check_location() const {
1321
0
    assert(Location && "cl::location(...) not specified for a command "
1322
0
                       "line option with external storage, "
1323
0
                       "or cl::init specified before cl::location()!!");
1324
0
  }
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIbLb1ELb0EE14check_locationEv
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EE14check_locationEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_111HelpPrinterELb1ELb1EE14check_locationEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_118HelpPrinterWrapperELb1ELb1EE14check_locationEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EE14check_locationEv
1325
1326
public:
1327
16
  opt_storage() = default;
_ZN4llvm2cl11opt_storageIbLb1ELb0EEC2Ev
Line
Count
Source
1327
4
  opt_storage() = default;
Debug.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EEC2Ev
Line
Count
Source
1327
2
  opt_storage() = default;
CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_111HelpPrinterELb1ELb1EEC2Ev
Line
Count
Source
1327
4
  opt_storage() = default;
CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_118HelpPrinterWrapperELb1ELb1EEC2Ev
Line
Count
Source
1327
4
  opt_storage() = default;
CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EEC2Ev
Line
Count
Source
1327
2
  opt_storage() = default;
1328
1329
16
  bool setLocation(Option &O, DataType &L) {
1330
16
    if (Location)
1331
0
      return O.error("cl::location(x) specified more than once!");
1332
16
    Location = &L;
1333
16
    Default = L;
1334
16
    return false;
1335
16
  }
_ZN4llvm2cl11opt_storageIbLb1ELb0EE11setLocationERNS0_6OptionERb
Line
Count
Source
1329
4
  bool setLocation(Option &O, DataType &L) {
1330
4
    if (Location)
1331
0
      return O.error("cl::location(x) specified more than once!");
1332
4
    Location = &L;
1333
4
    Default = L;
1334
4
    return false;
1335
4
  }
Debug.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EE11setLocationERNS0_6OptionERS3_
Line
Count
Source
1329
2
  bool setLocation(Option &O, DataType &L) {
1330
2
    if (Location)
1331
0
      return O.error("cl::location(x) specified more than once!");
1332
2
    Location = &L;
1333
2
    Default = L;
1334
2
    return false;
1335
2
  }
CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_111HelpPrinterELb1ELb1EE11setLocationERNS0_6OptionERS3_
Line
Count
Source
1329
4
  bool setLocation(Option &O, DataType &L) {
1330
4
    if (Location)
1331
0
      return O.error("cl::location(x) specified more than once!");
1332
4
    Location = &L;
1333
4
    Default = L;
1334
4
    return false;
1335
4
  }
CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_118HelpPrinterWrapperELb1ELb1EE11setLocationERNS0_6OptionERS3_
Line
Count
Source
1329
4
  bool setLocation(Option &O, DataType &L) {
1330
4
    if (Location)
1331
0
      return O.error("cl::location(x) specified more than once!");
1332
4
    Location = &L;
1333
4
    Default = L;
1334
4
    return false;
1335
4
  }
CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EE11setLocationERNS0_6OptionERS3_
Line
Count
Source
1329
2
  bool setLocation(Option &O, DataType &L) {
1330
2
    if (Location)
1331
0
      return O.error("cl::location(x) specified more than once!");
1332
2
    Location = &L;
1333
2
    Default = L;
1334
2
    return false;
1335
2
  }
1336
1337
0
  template <class T> void setValue(const T &V, bool initial = false) {
1338
0
    check_location();
1339
0
    *Location = V;
1340
0
    if (initial)
1341
0
      Default = V;
1342
0
  }
Unexecuted instantiation: _ZN4llvm2cl11opt_storageIbLb1ELb0EE8setValueIbEEvRKT_b
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EE8setValueINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEvRKT_b
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EE8setValueIS3_EEvRKT_b
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_111HelpPrinterELb1ELb1EE8setValueIbEEvRKT_b
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_118HelpPrinterWrapperELb1ELb1EE8setValueIbEEvRKT_b
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EE8setValueIbEEvRKT_b
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EE8setValueIS3_EEvRKT_b
1343
1344
  DataType &getValue() {
1345
    check_location();
1346
    return *Location;
1347
  }
1348
0
  const DataType &getValue() const {
1349
0
    check_location();
1350
0
    return *Location;
1351
0
  }
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIbLb1ELb0EE8getValueEv
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EE8getValueEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_111HelpPrinterELb1ELb1EE8getValueEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_118HelpPrinterWrapperELb1ELb1EE8getValueEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EE8getValueEv
1352
1353
  operator DataType() const { return this->getValue(); }
1354
1355
0
  const OptionValue<DataType> &getDefault() const { return Default; }
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIbLb1ELb0EE10getDefaultEv
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_112DebugOnlyOptELb1ELb1EE10getDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_111HelpPrinterELb1ELb1EE10getDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_118HelpPrinterWrapperELb1ELb1EE10getDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl11opt_storageIN12_GLOBAL__N_114VersionPrinterELb1ELb1EE10getDefaultEv
1356
};
1357
1358
// Define how to hold a class type object, such as a string.  Since we can
1359
// inherit from a class, we do so.  This makes us exactly compatible with the
1360
// object in all cases that it is used.
1361
//
1362
template <class DataType>
1363
class opt_storage<DataType, false, true> : public DataType {
1364
public:
1365
  OptionValue<DataType> Default;
1366
1367
0
  template <class T> void setValue(const T &V, bool initial = false) {
1368
0
    DataType::operator=(V);
1369
0
    if (initial)
1370
0
      Default = V;
1371
0
  }
1372
1373
  DataType &getValue() { return *this; }
1374
0
  const DataType &getValue() const { return *this; }
1375
1376
0
  const OptionValue<DataType> &getDefault() const { return Default; }
1377
};
1378
1379
// Define a partial specialization to handle things we cannot inherit from.  In
1380
// this case, we store an instance through containment, and overload operators
1381
// to get at the value.
1382
//
1383
template <class DataType> class opt_storage<DataType, false, false> {
1384
public:
1385
  DataType Value;
1386
  OptionValue<DataType> Default;
1387
1388
  // Make sure we initialize the value with the default constructor for the
1389
  // type.
1390
8
  opt_storage() : Value(DataType()), Default(DataType()) {}
_ZN4llvm2cl11opt_storageIjLb0ELb0EEC2Ev
Line
Count
Source
1390
2
  opt_storage() : Value(DataType()), Default(DataType()) {}
_ZN4llvm2cl11opt_storageIbLb0ELb0EEC2Ev
Line
Count
Source
1390
4
  opt_storage() : Value(DataType()), Default(DataType()) {}
_ZN4llvm2cl11opt_storageINS0_13boolOrDefaultELb0ELb0EEC2Ev
Line
Count
Source
1390
2
  opt_storage() : Value(DataType()), Default(DataType()) {}
Unexecuted instantiation: _ZN4llvm2cl11opt_storageIlLb0ELb0EEC2Ev
1391
1392
8
  template <class T> void setValue(const T &V, bool initial = false) {
1393
8
    Value = V;
1394
8
    if (initial)
1395
8
      Default = V;
1396
8
  }
_ZN4llvm2cl11opt_storageIjLb0ELb0EE8setValueIjEEvRKT_b
Line
Count
Source
1392
2
  template <class T> void setValue(const T &V, bool initial = false) {
1393
2
    Value = V;
1394
2
    if (initial)
1395
2
      Default = V;
1396
2
  }
Unexecuted instantiation: _ZN4llvm2cl11opt_storageIiLb0ELb0EE8setValueIiEEvRKT_b
Unexecuted instantiation: _ZN4llvm2cl11opt_storageIcLb0ELb0EE8setValueIcEEvRKT_b
_ZN4llvm2cl11opt_storageIbLb0ELb0EE8setValueIbEEvRKT_b
Line
Count
Source
1392
4
  template <class T> void setValue(const T &V, bool initial = false) {
1393
4
    Value = V;
1394
4
    if (initial)
1395
4
      Default = V;
1396
4
  }
_ZN4llvm2cl11opt_storageINS0_13boolOrDefaultELb0ELb0EE8setValueIS2_EEvRKT_b
Line
Count
Source
1392
2
  template <class T> void setValue(const T &V, bool initial = false) {
1393
2
    Value = V;
1394
2
    if (initial)
1395
2
      Default = V;
1396
2
  }
Unexecuted instantiation: _ZN4llvm2cl11opt_storageIlLb0ELb0EE8setValueIlEEvRKT_b
1397
  DataType &getValue() { return Value; }
1398
0
  DataType getValue() const { return Value; }
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIjLb0ELb0EE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIiLb0ELb0EE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIcLb0ELb0EE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIbLb0ELb0EE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageINS0_13boolOrDefaultELb0ELb0EE8getValueEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIlLb0ELb0EE8getValueEv
1399
1400
0
  const OptionValue<DataType> &getDefault() const { return Default; }
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIjLb0ELb0EE10getDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIiLb0ELb0EE10getDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIcLb0ELb0EE10getDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIbLb0ELb0EE10getDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageINS0_13boolOrDefaultELb0ELb0EE10getDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIlLb0ELb0EE10getDefaultEv
1401
1402
0
  operator DataType() const { return getValue(); }
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIjLb0ELb0EEcvjEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIbLb0ELb0EEcvbEv
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageINS0_13boolOrDefaultELb0ELb0EEcvS2_Ev
Unexecuted instantiation: _ZNK4llvm2cl11opt_storageIlLb0ELb0EEcvlEv
1403
1404
  // If the datatype is a pointer, support -> on it.
1405
  DataType operator->() const { return Value; }
1406
};
1407
1408
//===----------------------------------------------------------------------===//
1409
// opt - A scalar command line option.
1410
//
1411
template <class DataType, bool ExternalStorage = false,
1412
          class ParserClass = parser<DataType>>
1413
class opt : public Option,
1414
            public opt_storage<DataType, ExternalStorage,
1415
                               std::is_class<DataType>::value> {
1416
  ParserClass Parser;
1417
1418
  bool handleOccurrence(unsigned pos, StringRef ArgName,
1419
0
                        StringRef Arg) override {
1420
0
    typename ParserClass::parser_data_type Val =
1421
0
        typename ParserClass::parser_data_type();
1422
0
    if (Parser.parse(*this, ArgName, Arg, Val))
1423
0
      return true; // Parse error!
1424
0
    this->setValue(Val);
1425
0
    this->setPosition(pos);
1426
0
    Callback(Val);
1427
0
    return false;
1428
0
  }
Unexecuted instantiation: _ZN4llvm2cl3optIbLb1ENS0_6parserIbEEE16handleOccurrenceEjNS_9StringRefES5_
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE16handleOccurrenceEjNS_9StringRefESD_
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE16handleOccurrenceEjNS_9StringRefES5_
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE16handleOccurrenceEjNS_9StringRefES5_
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE16handleOccurrenceEjNS_9StringRefESB_
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE16handleOccurrenceEjNS_9StringRefES5_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE16handleOccurrenceEjNS_9StringRefES5_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE16handleOccurrenceEjNS_9StringRefES7_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE16handleOccurrenceEjNS_9StringRefES7_
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE16handleOccurrenceEjNS_9StringRefES7_
Unexecuted instantiation: _ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE16handleOccurrenceEjNS_9StringRefES6_
Unexecuted instantiation: _ZN4llvm2cl3optIlLb0ENS0_6parserIlEEE16handleOccurrenceEjNS_9StringRefES5_
1429
1430
0
  enum ValueExpected getValueExpectedFlagDefault() const override {
1431
0
    return Parser.getValueExpectedFlagDefault();
1432
0
  }
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb1ENS0_6parserIbEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optIjLb0ENS0_6parserIjEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optIiLb0ENS0_6parserIiEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optIcLb0ENS0_6parserIcEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb0ENS0_6parserIbEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE27getValueExpectedFlagDefaultEv
Unexecuted instantiation: _ZNK4llvm2cl3optIlLb0ENS0_6parserIlEEE27getValueExpectedFlagDefaultEv
1433
1434
0
  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override {
1435
0
    return Parser.getExtraOptionNames(OptionNames);
1436
0
  }
Unexecuted instantiation: _ZN4llvm2cl3optIbLb1ENS0_6parserIbEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
Unexecuted instantiation: _ZN4llvm2cl3optIlLb0ENS0_6parserIlEEE19getExtraOptionNamesERNS_15SmallVectorImplINS_9StringRefEEE
1437
1438
  // Forward printing stuff to the parser...
1439
0
  size_t getOptionWidth() const override {
1440
0
    return Parser.getOptionWidth(*this);
1441
0
  }
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb1ENS0_6parserIbEEE14getOptionWidthEv
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optIjLb0ENS0_6parserIjEEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optIiLb0ENS0_6parserIiEEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optIcLb0ENS0_6parserIcEEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb0ENS0_6parserIbEEE14getOptionWidthEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE14getOptionWidthEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE14getOptionWidthEv
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE14getOptionWidthEv
Unexecuted instantiation: _ZNK4llvm2cl3optIlLb0ENS0_6parserIlEEE14getOptionWidthEv
1442
1443
0
  void printOptionInfo(size_t GlobalWidth) const override {
1444
0
    Parser.printOptionInfo(*this, GlobalWidth);
1445
0
  }
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb1ENS0_6parserIbEEE15printOptionInfoEm
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optIjLb0ENS0_6parserIjEEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optIiLb0ENS0_6parserIiEEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optIcLb0ENS0_6parserIcEEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb0ENS0_6parserIbEEE15printOptionInfoEm
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE15printOptionInfoEm
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE15printOptionInfoEm
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE15printOptionInfoEm
Unexecuted instantiation: _ZNK4llvm2cl3optIlLb0ENS0_6parserIlEEE15printOptionInfoEm
1446
1447
0
  void printOptionValue(size_t GlobalWidth, bool Force) const override {
1448
0
    if (Force || this->getDefault().compare(this->getValue())) {
1449
0
      cl::printOptionDiff<ParserClass>(*this, Parser, this->getValue(),
1450
0
                                       this->getDefault(), GlobalWidth);
1451
0
    }
1452
0
  }
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb1ENS0_6parserIbEEE16printOptionValueEmb
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optIjLb0ENS0_6parserIjEEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optIiLb0ENS0_6parserIiEEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optIcLb0ENS0_6parserIcEEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb0ENS0_6parserIbEEE16printOptionValueEmb
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE16printOptionValueEmb
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE16printOptionValueEmb
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE16printOptionValueEmb
Unexecuted instantiation: _ZNK4llvm2cl3optIlLb0ENS0_6parserIlEEE16printOptionValueEmb
1453
1454
  template <class T,
1455
            class = std::enable_if_t<std::is_assignable<T &, T>::value>>
1456
0
  void setDefaultImpl() {
1457
0
    const OptionValue<DataType> &V = this->getDefault();
1458
0
    if (V.hasValue())
1459
0
      this->setValue(V.getValue());
1460
0
  }
Unexecuted instantiation: _ZN4llvm2cl3optIbLb1ENS0_6parserIbEEE14setDefaultImplIbvEEvv
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE14setDefaultImplIS3_vEEvv
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE14setDefaultImplIS3_vEEvv
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE14setDefaultImplIjvEEvv
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE14setDefaultImplIivEEvv
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE14setDefaultImplIS7_vEEvv
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE14setDefaultImplIcvEEvv
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE14setDefaultImplIbvEEvv
Unexecuted instantiation: _ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE14setDefaultImplIS2_vEEvv
Unexecuted instantiation: _ZN4llvm2cl3optIlLb0ENS0_6parserIlEEE14setDefaultImplIlvEEvv
1461
1462
  template <class T,
1463
            class = std::enable_if_t<!std::is_assignable<T &, T>::value>>
1464
0
  void setDefaultImpl(...) {}
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE14setDefaultImplIS3_vEEvz
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE14setDefaultImplIS3_vEEvz
1465
1466
0
  void setDefault() override { setDefaultImpl<DataType>(); }
Unexecuted instantiation: _ZN4llvm2cl3optIbLb1ENS0_6parserIbEEE10setDefaultEv
Unexecuted instantiation: Debug.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE10setDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE10setDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE10setDefaultEv
Unexecuted instantiation: CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE10setDefaultEv
Unexecuted instantiation: _ZN4llvm2cl3optIlLb0ENS0_6parserIlEEE10setDefaultEv
1467
1468
24
  void done() {
1469
24
    addArgument();
1470
24
    Parser.initialize();
1471
24
  }
_ZN4llvm2cl3optIbLb1ENS0_6parserIbEEE4doneEv
Line
Count
Source
1468
4
  void done() {
1469
4
    addArgument();
1470
4
    Parser.initialize();
1471
4
  }
Debug.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEE4doneEv
Line
Count
Source
1468
2
  void done() {
1469
2
    addArgument();
1470
2
    Parser.initialize();
1471
2
  }
_ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE4doneEv
Line
Count
Source
1468
2
  void done() {
1469
2
    addArgument();
1470
2
    Parser.initialize();
1471
2
  }
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE4doneEv
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE4doneEv
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE4doneEv
_ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE4doneEv
Line
Count
Source
1468
4
  void done() {
1469
4
    addArgument();
1470
4
    Parser.initialize();
1471
4
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEE4doneEv
Line
Count
Source
1468
4
  void done() {
1469
4
    addArgument();
1470
4
    Parser.initialize();
1471
4
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEE4doneEv
Line
Count
Source
1468
4
  void done() {
1469
4
    addArgument();
1470
4
    Parser.initialize();
1471
4
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEE4doneEv
Line
Count
Source
1468
2
  void done() {
1469
2
    addArgument();
1470
2
    Parser.initialize();
1471
2
  }
_ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE4doneEv
Line
Count
Source
1468
2
  void done() {
1469
2
    addArgument();
1470
2
    Parser.initialize();
1471
2
  }
Unexecuted instantiation: _ZN4llvm2cl3optIlLb0ENS0_6parserIlEEE4doneEv
1472
1473
public:
1474
  // Command line options should not be copyable
1475
  opt(const opt &) = delete;
1476
  opt &operator=(const opt &) = delete;
1477
1478
  // setInitialValue - Used by the cl::init modifier...
1479
8
  void setInitialValue(const DataType &V) { this->setValue(V, true); }
_ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE15setInitialValueERKj
Line
Count
Source
1479
2
  void setInitialValue(const DataType &V) { this->setValue(V, true); }
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE15setInitialValueERKi
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE15setInitialValueERKS7_
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE15setInitialValueERKc
_ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE15setInitialValueERKb
Line
Count
Source
1479
4
  void setInitialValue(const DataType &V) { this->setValue(V, true); }
_ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEE15setInitialValueERKS2_
Line
Count
Source
1479
2
  void setInitialValue(const DataType &V) { this->setValue(V, true); }
1480
1481
0
  ParserClass &getParser() { return Parser; }
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE9getParserEv
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE9getParserEv
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE9getParserEv
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE9getParserEv
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE9getParserEv
1482
1483
  template <class T> DataType &operator=(const T &Val) {
1484
    this->setValue(Val);
1485
    Callback(Val);
1486
    return this->getValue();
1487
  }
1488
1489
  template <class... Mods>
1490
  explicit opt(const Mods &... Ms)
1491
24
      : Option(Optional, NotHidden), Parser(*this) {
1492
24
    apply(this, Ms...);
1493
24
    done();
1494
24
  }
_ZN4llvm2cl3optIbLb1ENS0_6parserIbEEEC2IJA6_cNS0_4descENS0_12OptionHiddenENS0_13LocationClassIbEEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
_ZN4llvm2cl3optIjLb0ENS0_6parserIjEEEC2IJA18_cNS0_4descENS0_12OptionHiddenENS0_11initializerIiEEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
Debug.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEC2IJA11_cNS0_4descENS0_12OptionHiddenENS0_18NumOccurrencesFlagENS0_10value_descENS0_13LocationClassIS3_EENS0_13ValueExpectedEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEC2IJA10_cNS0_4descENS0_13LocationClassIS3_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEC2IJA17_cNS0_4descENS0_13LocationClassIS3_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEC2IJA5_cNS0_4descENS0_13LocationClassIS3_EENS0_13ValueExpectedENS0_3catENS0_3subEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEC2IJA12_cNS0_4descENS0_13LocationClassIS3_EENS0_12OptionHiddenENS0_13ValueExpectedENS0_3catENS0_3subEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
_ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA14_cNS0_4descENS0_12OptionHiddenENS0_11initializerIbEENS0_3catENS0_3subEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
_ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA18_cNS0_4descENS0_12OptionHiddenENS0_11initializerIbEENS0_3catENS0_3subEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
CommandLine.cpp:_ZN4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEC2IJA8_cNS0_4descENS0_13LocationClassIS3_EENS0_13ValueExpectedENS0_3catEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
_ZN4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEEC2IJA6_cNS0_3catENS0_4descENS0_11initializerIS2_EEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
_ZN4llvm2cl3optIbLb1ENS0_6parserIbEEEC2IJA22_cNS0_4descENS0_13LocationClassIbEENS0_12OptionHiddenEEEEDpRKT_
Line
Count
Source
1491
2
      : Option(Optional, NotHidden), Parser(*this) {
1492
2
    apply(this, Ms...);
1493
2
    done();
1494
2
  }
Unexecuted instantiation: _ZN4llvm2cl3optIlLb0ENS0_6parserIlEEEC2IJA44_cNS0_4descEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEEC2IJA35_cNS0_4descEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA21_cNS0_11initializerIbEENS0_4descEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA22_cNS0_11initializerIbEENS0_4descEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA22_cNS0_11initializerIbEENS0_4descENS0_12OptionHiddenEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA23_cNS0_11initializerIbEENS0_4descENS0_12OptionHiddenEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA23_cNS0_4descEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA28_cNS0_4descENS0_11initializerIbEEEEEDpRKT_
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEEC2IJA36_cNS0_4descEEEEDpRKT_
1495
1496
  void setCallback(
1497
0
      std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1498
0
    Callback = CB;
1499
0
  }
Unexecuted instantiation: _ZN4llvm2cl3optIjLb0ENS0_6parserIjEEE11setCallbackESt8functionIFvRKjEE
Unexecuted instantiation: _ZN4llvm2cl3optIiLb0ENS0_6parserIiEEE11setCallbackESt8functionIFvRKiEE
Unexecuted instantiation: _ZN4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEE11setCallbackESt8functionIFvRKS7_EE
Unexecuted instantiation: _ZN4llvm2cl3optIcLb0ENS0_6parserIcEEE11setCallbackESt8functionIFvRKcEE
Unexecuted instantiation: _ZN4llvm2cl3optIbLb0ENS0_6parserIbEEE11setCallbackESt8functionIFvRKbEE
1500
1501
  std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1502
0
      [](const typename ParserClass::parser_data_type &) {};
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb1ENS0_6parserIbEEEUlRKbE_clES6_
Unexecuted instantiation: _ZNK4llvm2cl3optIjLb0ENS0_6parserIjEEEUlRKjE_clES6_
Unexecuted instantiation: Debug.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_112DebugOnlyOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEUlRKSA_E_clESE_
Unexecuted instantiation: _ZNK4llvm2cl3optIjLb0ENS0_6parserIjEEEUt_clERKj
Unexecuted instantiation: _ZNK4llvm2cl3optIiLb0ENS0_6parserIiEEEUt_clERKi
Unexecuted instantiation: _ZNK4llvm2cl3optINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEELb0ENS0_6parserIS7_EEEUt_clERKS7_
Unexecuted instantiation: _ZNK4llvm2cl3optIcLb0ENS0_6parserIcEEEUt_clERKc
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb0ENS0_6parserIbEEEUt_clERKb
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_111HelpPrinterELb1ENS0_6parserIbEEEUlRKbE_clES8_
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_118HelpPrinterWrapperELb1ENS0_6parserIbEEEUlRKbE_clES8_
Unexecuted instantiation: _ZNK4llvm2cl3optIbLb0ENS0_6parserIbEEEUlRKbE_clES6_
Unexecuted instantiation: CommandLine.cpp:_ZNK4llvm2cl3optIN12_GLOBAL__N_114VersionPrinterELb1ENS0_6parserIbEEEUlRKbE_clES8_
Unexecuted instantiation: _ZNK4llvm2cl3optINS0_13boolOrDefaultELb0ENS0_6parserIS2_EEEUlRKS2_E_clES7_
Unexecuted instantiation: _ZNK4llvm2cl3optIlLb0ENS0_6parserIlEEEUlRKlE_clES6_
1503
};
1504
1505
extern template class opt<unsigned>;
1506
extern template class opt<int>;
1507
extern template class opt<std::string>;
1508
extern template class opt<char>;
1509
extern template class opt<bool>;
1510
1511
//===----------------------------------------------------------------------===//
1512
// list_storage class
1513
1514
// Default storage class definition: external storage.  This implementation
1515
// assumes the user will specify a variable to store the data into with the
1516
// cl::location(x) modifier.
1517
//
1518
template <class DataType, class StorageClass> class list_storage {
1519
  StorageClass *Location = nullptr; // Where to store the object...
1520
1521
public:
1522
  list_storage() = default;
1523
1524
  void clear() {}
1525
1526
  bool setLocation(Option &O, StorageClass &L) {
1527
    if (Location)
1528
      return O.error("cl::location(x) specified more than once!");
1529
    Location = &L;
1530
    return false;
1531
  }
1532
1533
  template <class T> void addValue(const T &V) {
1534
    assert(Location != 0 && "cl::location(...) not specified for a command "
1535
                            "line option with external storage!");
1536
    Location->push_back(V);
1537
  }
1538
};
1539
1540
// Define how to hold a class type object, such as a string.
1541
// Originally this code inherited from std::vector. In transitioning to a new
1542
// API for command line options we should change this. The new implementation
1543
// of this list_storage specialization implements the minimum subset of the
1544
// std::vector API required for all the current clients.
1545
//
1546
// FIXME: Reduce this API to a more narrow subset of std::vector
1547
//
1548
template <class DataType> class list_storage<DataType, bool> {
1549
  std::vector<DataType> Storage;
1550
1551
public:
1552
  using iterator = typename std::vector<DataType>::iterator;
1553
1554
  iterator begin() { return Storage.begin(); }
1555
  iterator end() { return Storage.end(); }
1556
1557
  using const_iterator = typename std::vector<DataType>::const_iterator;
1558
1559
  const_iterator begin() const { return Storage.begin(); }
1560
  const_iterator end() const { return Storage.end(); }
1561
1562
  using size_type = typename std::vector<DataType>::size_type;
1563
1564
  size_type size() const { return Storage.size(); }
1565
1566
  bool empty() const { return Storage.empty(); }
1567
1568
  void push_back(const DataType &value) { Storage.push_back(value); }
1569
  void push_back(DataType &&value) { Storage.push_back(value); }
1570
1571
  using reference = typename std::vector<DataType>::reference;
1572
  using const_reference = typename std::vector<DataType>::const_reference;
1573
1574
  reference operator[](size_type pos) { return Storage[pos]; }
1575
  const_reference operator[](size_type pos) const { return Storage[pos]; }
1576
1577
  void clear() {
1578
    Storage.clear();
1579
  }
1580
1581
  iterator erase(const_iterator pos) { return Storage.erase(pos); }
1582
  iterator erase(const_iterator first, const_iterator last) {
1583
    return Storage.erase(first, last);
1584
  }
1585
1586
  iterator erase(iterator pos) { return Storage.erase(pos); }
1587
  iterator erase(iterator first, iterator last) {
1588
    return Storage.erase(first, last);
1589
  }
1590
1591
  iterator insert(const_iterator pos, const DataType &value) {
1592
    return Storage.insert(pos, value);
1593
  }
1594
  iterator insert(const_iterator pos, DataType &&value) {
1595
    return Storage.insert(pos, value);
1596
  }
1597
1598
  iterator insert(iterator pos, const DataType &value) {
1599
    return Storage.insert(pos, value);
1600
  }
1601
  iterator insert(iterator pos, DataType &&value) {
1602
    return Storage.insert(pos, value);
1603
  }
1604
1605
  reference front() { return Storage.front(); }
1606
  const_reference front() const { return Storage.front(); }
1607
1608
  operator std::vector<DataType> &() { return Storage; }
1609
  operator ArrayRef<DataType>() const { return Storage; }
1610
  std::vector<DataType> *operator&() { return &Storage; }
1611
  const std::vector<DataType> *operator&() const { return &Storage; }
1612
1613
  template <class T> void addValue(const T &V) { Storage.push_back(V); }
1614
};
1615
1616
//===----------------------------------------------------------------------===//
1617
// list - A list of command line options.
1618
//
1619
template <class DataType, class StorageClass = bool,
1620
          class ParserClass = parser<DataType>>
1621
class list : public Option, public list_storage<DataType, StorageClass> {
1622
  std::vector<unsigned> Positions;
1623
  ParserClass Parser;
1624
1625
  enum ValueExpected getValueExpectedFlagDefault() const override {
1626
    return Parser.getValueExpectedFlagDefault();
1627
  }
1628
1629
  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override {
1630
    return Parser.getExtraOptionNames(OptionNames);
1631
  }
1632
1633
  bool handleOccurrence(unsigned pos, StringRef ArgName,
1634
                        StringRef Arg) override {
1635
    typename ParserClass::parser_data_type Val =
1636
        typename ParserClass::parser_data_type();
1637
    if (Parser.parse(*this, ArgName, Arg, Val))
1638
      return true; // Parse Error!
1639
    list_storage<DataType, StorageClass>::addValue(Val);
1640
    setPosition(pos);
1641
    Positions.push_back(pos);
1642
    Callback(Val);
1643
    return false;
1644
  }
1645
1646
  // Forward printing stuff to the parser...
1647
  size_t getOptionWidth() const override {
1648
    return Parser.getOptionWidth(*this);
1649
  }
1650
1651
  void printOptionInfo(size_t GlobalWidth) const override {
1652
    Parser.printOptionInfo(*this, GlobalWidth);
1653
  }
1654
1655
  // Unimplemented: list options don't currently store their default value.
1656
  void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
1657
  }
1658
1659
  void setDefault() override {
1660
    Positions.clear();
1661
    list_storage<DataType, StorageClass>::clear();
1662
  }
1663
1664
  void done() {
1665
    addArgument();
1666
    Parser.initialize();
1667
  }
1668
1669
public:
1670
  // Command line options should not be copyable
1671
  list(const list &) = delete;
1672
  list &operator=(const list &) = delete;
1673
1674
  ParserClass &getParser() { return Parser; }
1675
1676
  unsigned getPosition(unsigned optnum) const {
1677
    assert(optnum < this->size() && "Invalid option index");
1678
    return Positions[optnum];
1679
  }
1680
1681
  void setNumAdditionalVals(unsigned n) { Option::setNumAdditionalVals(n); }
1682
1683
  template <class... Mods>
1684
  explicit list(const Mods &... Ms)
1685
      : Option(ZeroOrMore, NotHidden), Parser(*this) {
1686
    apply(this, Ms...);
1687
    done();
1688
  }
1689
1690
  void setCallback(
1691
      std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1692
    Callback = CB;
1693
  }
1694
1695
  std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1696
      [](const typename ParserClass::parser_data_type &) {};
1697
};
1698
1699
// multi_val - Modifier to set the number of additional values.
1700
struct multi_val {
1701
  unsigned AdditionalVals;
1702
0
  explicit multi_val(unsigned N) : AdditionalVals(N) {}
1703
1704
  template <typename D, typename S, typename P>
1705
  void apply(list<D, S, P> &L) const {
1706
    L.setNumAdditionalVals(AdditionalVals);
1707
  }
1708
};
1709
1710
//===----------------------------------------------------------------------===//
1711
// bits_storage class
1712
1713
// Default storage class definition: external storage.  This implementation
1714
// assumes the user will specify a variable to store the data into with the
1715
// cl::location(x) modifier.
1716
//
1717
template <class DataType, class StorageClass> class bits_storage {
1718
  unsigned *Location = nullptr; // Where to store the bits...
1719
1720
  template <class T> static unsigned Bit(const T &V) {
1721
    unsigned BitPos = reinterpret_cast<unsigned>(V);
1722
    assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
1723
           "enum exceeds width of bit vector!");
1724
    return 1 << BitPos;
1725
  }
1726
1727
public:
1728
  bits_storage() = default;
1729
1730
  bool setLocation(Option &O, unsigned &L) {
1731
    if (Location)
1732
      return O.error("cl::location(x) specified more than once!");
1733
    Location = &L;
1734
    return false;
1735
  }
1736
1737
  template <class T> void addValue(const T &V) {
1738
    assert(Location != 0 && "cl::location(...) not specified for a command "
1739
                            "line option with external storage!");
1740
    *Location |= Bit(V);
1741
  }
1742
1743
  unsigned getBits() { return *Location; }
1744
1745
  template <class T> bool isSet(const T &V) {
1746
    return (*Location & Bit(V)) != 0;
1747
  }
1748
};
1749
1750
// Define how to hold bits.  Since we can inherit from a class, we do so.
1751
// This makes us exactly compatible with the bits in all cases that it is used.
1752
//
1753
template <class DataType> class bits_storage<DataType, bool> {
1754
  unsigned Bits; // Where to store the bits...
1755
1756
  template <class T> static unsigned Bit(const T &V) {
1757
    unsigned BitPos = (unsigned)V;
1758
    assert(BitPos < sizeof(unsigned) * CHAR_BIT &&
1759
           "enum exceeds width of bit vector!");
1760
    return 1 << BitPos;
1761
  }
1762
1763
public:
1764
  template <class T> void addValue(const T &V) { Bits |= Bit(V); }
1765
1766
  unsigned getBits() { return Bits; }
1767
1768
  template <class T> bool isSet(const T &V) { return (Bits & Bit(V)) != 0; }
1769
};
1770
1771
//===----------------------------------------------------------------------===//
1772
// bits - A bit vector of command options.
1773
//
1774
template <class DataType, class Storage = bool,
1775
          class ParserClass = parser<DataType>>
1776
class bits : public Option, public bits_storage<DataType, Storage> {
1777
  std::vector<unsigned> Positions;
1778
  ParserClass Parser;
1779
1780
  enum ValueExpected getValueExpectedFlagDefault() const override {
1781
    return Parser.getValueExpectedFlagDefault();
1782
  }
1783
1784
  void getExtraOptionNames(SmallVectorImpl<StringRef> &OptionNames) override {
1785
    return Parser.getExtraOptionNames(OptionNames);
1786
  }
1787
1788
  bool handleOccurrence(unsigned pos, StringRef ArgName,
1789
                        StringRef Arg) override {
1790
    typename ParserClass::parser_data_type Val =
1791
        typename ParserClass::parser_data_type();
1792
    if (Parser.parse(*this, ArgName, Arg, Val))
1793
      return true; // Parse Error!
1794
    this->addValue(Val);
1795
    setPosition(pos);
1796
    Positions.push_back(pos);
1797
    Callback(Val);
1798
    return false;
1799
  }
1800
1801
  // Forward printing stuff to the parser...
1802
  size_t getOptionWidth() const override {
1803
    return Parser.getOptionWidth(*this);
1804
  }
1805
1806
  void printOptionInfo(size_t GlobalWidth) const override {
1807
    Parser.printOptionInfo(*this, GlobalWidth);
1808
  }
1809
1810
  // Unimplemented: bits options don't currently store their default values.
1811
  void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
1812
  }
1813
1814
  void setDefault() override {}
1815
1816
  void done() {
1817
    addArgument();
1818
    Parser.initialize();
1819
  }
1820
1821
public:
1822
  // Command line options should not be copyable
1823
  bits(const bits &) = delete;
1824
  bits &operator=(const bits &) = delete;
1825
1826
  ParserClass &getParser() { return Parser; }
1827
1828
  unsigned getPosition(unsigned optnum) const {
1829
    assert(optnum < this->size() && "Invalid option index");
1830
    return Positions[optnum];
1831
  }
1832
1833
  template <class... Mods>
1834
  explicit bits(const Mods &... Ms)
1835
      : Option(ZeroOrMore, NotHidden), Parser(*this) {
1836
    apply(this, Ms...);
1837
    done();
1838
  }
1839
1840
  void setCallback(
1841
      std::function<void(const typename ParserClass::parser_data_type &)> CB) {
1842
    Callback = CB;
1843
  }
1844
1845
  std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1846
      [](const typename ParserClass::parser_data_type &) {};
1847
};
1848
1849
//===----------------------------------------------------------------------===//
1850
// Aliased command line option (alias this name to a preexisting name)
1851
//
1852
1853
class alias : public Option {
1854
  Option *AliasFor;
1855
1856
  bool handleOccurrence(unsigned pos, StringRef /*ArgName*/,
1857
0
                        StringRef Arg) override {
1858
0
    return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg);
1859
0
  }
1860
1861
  bool addOccurrence(unsigned pos, StringRef /*ArgName*/, StringRef Value,
1862
0
                     bool MultiArg = false) override {
1863
0
    return AliasFor->addOccurrence(pos, AliasFor->ArgStr, Value, MultiArg);
1864
0
  }
1865
1866
  // Handle printing stuff...
1867
  size_t getOptionWidth() const override;
1868
  void printOptionInfo(size_t GlobalWidth) const override;
1869
1870
  // Aliases do not need to print their values.
1871
0
  void printOptionValue(size_t /*GlobalWidth*/, bool /*Force*/) const override {
1872
0
  }
1873
1874
0
  void setDefault() override { AliasFor->setDefault(); }
1875
1876
0
  ValueExpected getValueExpectedFlagDefault() const override {
1877
0
    return AliasFor->getValueExpectedFlag();
1878
0
  }
1879
1880
2
  void done() {
1881
2
    if (!hasArgStr())
1882
0
      error("cl::alias must have argument name specified!");
1883
2
    if (!AliasFor)
1884
0
      error("cl::alias must have an cl::aliasopt(option) specified!");
1885
2
    if (!Subs.empty())
1886
0
      error("cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
1887
2
    Subs = AliasFor->Subs;
1888
2
    Categories = AliasFor->Categories;
1889
2
    addArgument();
1890
2
  }
1891
1892
public:
1893
  // Command line options should not be copyable
1894
  alias(const alias &) = delete;
1895
  alias &operator=(const alias &) = delete;
1896
1897
2
  void setAliasFor(Option &O) {
1898
2
    if (AliasFor)
1899
0
      error("cl::alias must only have one cl::aliasopt(...) specified!");
1900
2
    AliasFor = &O;
1901
2
  }
1902
1903
  template <class... Mods>
1904
  explicit alias(const Mods &... Ms)
1905
2
      : Option(Optional, Hidden), AliasFor(nullptr) {
1906
2
    apply(this, Ms...);
1907
2
    done();
1908
2
  }
1909
};
1910
1911
// aliasfor - Modifier to set the option an alias aliases.
1912
struct aliasopt {
1913
  Option &Opt;
1914
1915
2
  explicit aliasopt(Option &O) : Opt(O) {}
1916
1917
2
  void apply(alias &A) const { A.setAliasFor(Opt); }
1918
};
1919
1920
// extrahelp - provide additional help at the end of the normal help
1921
// output. All occurrences of cl::extrahelp will be accumulated and
1922
// printed to stderr at the end of the regular help, just before
1923
// exit is called.
1924
struct extrahelp {
1925
  StringRef morehelp;
1926
1927
  explicit extrahelp(StringRef help);
1928
};
1929
1930
void PrintVersionMessage();
1931
1932
/// This function just prints the help message, exactly the same way as if the
1933
/// -help or -help-hidden option had been given on the command line.
1934
///
1935
/// \param Hidden if true will print hidden options
1936
/// \param Categorized if true print options in categories
1937
void PrintHelpMessage(bool Hidden = false, bool Categorized = false);
1938
1939
//===----------------------------------------------------------------------===//
1940
// Public interface for accessing registered options.
1941
//
1942
1943
/// Use this to get a StringMap to all registered named options
1944
/// (e.g. -help).
1945
///
1946
/// \return A reference to the StringMap used by the cl APIs to parse options.
1947
///
1948
/// Access to unnamed arguments (i.e. positional) are not provided because
1949
/// it is expected that the client already has access to these.
1950
///
1951
/// Typical usage:
1952
/// \code
1953
/// main(int argc,char* argv[]) {
1954
/// StringMap<llvm::cl::Option*> &opts = llvm::cl::getRegisteredOptions();
1955
/// assert(opts.count("help") == 1)
1956
/// opts["help"]->setDescription("Show alphabetical help information")
1957
/// // More code
1958
/// llvm::cl::ParseCommandLineOptions(argc,argv);
1959
/// //More code
1960
/// }
1961
/// \endcode
1962
///
1963
/// This interface is useful for modifying options in libraries that are out of
1964
/// the control of the client. The options should be modified before calling
1965
/// llvm::cl::ParseCommandLineOptions().
1966
///
1967
/// Hopefully this API can be deprecated soon. Any situation where options need
1968
/// to be modified by tools or libraries should be handled by sane APIs rather
1969
/// than just handing around a global list.
1970
StringMap<Option *> &getRegisteredOptions(SubCommand &Sub = *TopLevelSubCommand);
1971
1972
/// Use this to get all registered SubCommands from the provided parser.
1973
///
1974
/// \return A range of all SubCommand pointers registered with the parser.
1975
///
1976
/// Typical usage:
1977
/// \code
1978
/// main(int argc, char* argv[]) {
1979
///   llvm::cl::ParseCommandLineOptions(argc, argv);
1980
///   for (auto* S : llvm::cl::getRegisteredSubcommands()) {
1981
///     if (*S) {
1982
///       std::cout << "Executing subcommand: " << S->getName() << std::endl;
1983
///       // Execute some function based on the name...
1984
///     }
1985
///   }
1986
/// }
1987
/// \endcode
1988
///
1989
/// This interface is useful for defining subcommands in libraries and
1990
/// the dispatch from a single point (like in the main function).
1991
iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator>
1992
getRegisteredSubcommands();
1993
1994
//===----------------------------------------------------------------------===//
1995
// Standalone command line processing utilities.
1996
//
1997
1998
/// Tokenizes a command line that can contain escapes and quotes.
1999
//
2000
/// The quoting rules match those used by GCC and other tools that use
2001
/// libiberty's buildargv() or expandargv() utilities, and do not match bash.
2002
/// They differ from buildargv() on treatment of backslashes that do not escape
2003
/// a special character to make it possible to accept most Windows file paths.
2004
///
2005
/// \param [in] Source The string to be split on whitespace with quotes.
2006
/// \param [in] Saver Delegates back to the caller for saving parsed strings.
2007
/// \param [in] MarkEOLs true if tokenizing a response file and you want end of
2008
/// lines and end of the response file to be marked with a nullptr string.
2009
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
2010
void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver,
2011
                            SmallVectorImpl<const char *> &NewArgv,
2012
                            bool MarkEOLs = false);
2013
2014
/// Tokenizes a Windows command line which may contain quotes and escaped
2015
/// quotes.
2016
///
2017
/// See MSDN docs for CommandLineToArgvW for information on the quoting rules.
2018
/// http://msdn.microsoft.com/en-us/library/windows/desktop/17w5ykft(v=vs.85).aspx
2019
///
2020
/// \param [in] Source The string to be split on whitespace with quotes.
2021
/// \param [in] Saver Delegates back to the caller for saving parsed strings.
2022
/// \param [in] MarkEOLs true if tokenizing a response file and you want end of
2023
/// lines and end of the response file to be marked with a nullptr string.
2024
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
2025
void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver,
2026
                                SmallVectorImpl<const char *> &NewArgv,
2027
                                bool MarkEOLs = false);
2028
2029
/// Tokenizes a Windows command line while attempting to avoid copies. If no
2030
/// quoting or escaping was used, this produces substrings of the original
2031
/// string. If a token requires unquoting, it will be allocated with the
2032
/// StringSaver.
2033
void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver,
2034
                                      SmallVectorImpl<StringRef> &NewArgv);
2035
2036
/// String tokenization function type.  Should be compatible with either
2037
/// Windows or Unix command line tokenizers.
2038
using TokenizerCallback = void (*)(StringRef Source, StringSaver &Saver,
2039
                                   SmallVectorImpl<const char *> &NewArgv,
2040
                                   bool MarkEOLs);
2041
2042
/// Tokenizes content of configuration file.
2043
///
2044
/// \param [in] Source The string representing content of config file.
2045
/// \param [in] Saver Delegates back to the caller for saving parsed strings.
2046
/// \param [out] NewArgv All parsed strings are appended to NewArgv.
2047
/// \param [in] MarkEOLs Added for compatibility with TokenizerCallback.
2048
///
2049
/// It works like TokenizeGNUCommandLine with ability to skip comment lines.
2050
///
2051
void tokenizeConfigFile(StringRef Source, StringSaver &Saver,
2052
                        SmallVectorImpl<const char *> &NewArgv,
2053
                        bool MarkEOLs = false);
2054
2055
/// Reads command line options from the given configuration file.
2056
///
2057
/// \param [in] CfgFileName Path to configuration file.
2058
/// \param [in] Saver  Objects that saves allocated strings.
2059
/// \param [out] Argv Array to which the read options are added.
2060
/// \return true if the file was successfully read.
2061
///
2062
/// It reads content of the specified file, tokenizes it and expands "@file"
2063
/// commands resolving file names in them relative to the directory where
2064
/// CfgFilename resides.
2065
///
2066
bool readConfigFile(StringRef CfgFileName, StringSaver &Saver,
2067
                    SmallVectorImpl<const char *> &Argv);
2068
2069
/// Expand response files on a command line recursively using the given
2070
/// StringSaver and tokenization strategy.  Argv should contain the command line
2071
/// before expansion and will be modified in place. If requested, Argv will
2072
/// also be populated with nullptrs indicating where each response file line
2073
/// ends, which is useful for the "/link" argument that needs to consume all
2074
/// remaining arguments only until the next end of line, when in a response
2075
/// file.
2076
///
2077
/// \param [in] Saver Delegates back to the caller for saving parsed strings.
2078
/// \param [in] Tokenizer Tokenization strategy. Typically Unix or Windows.
2079
/// \param [in,out] Argv Command line into which to expand response files.
2080
/// \param [in] MarkEOLs Mark end of lines and the end of the response file
2081
/// with nullptrs in the Argv vector.
2082
/// \param [in] RelativeNames true if names of nested response files must be
2083
/// resolved relative to including file.
2084
/// \param [in] FS File system used for all file access when running the tool.
2085
/// \param [in] CurrentDir Path used to resolve relative rsp files. If set to
2086
/// None, process' cwd is used instead.
2087
/// \return true if all @files were expanded successfully or there were none.
2088
bool ExpandResponseFiles(
2089
    StringSaver &Saver, TokenizerCallback Tokenizer,
2090
    SmallVectorImpl<const char *> &Argv, bool MarkEOLs = false,
2091
    bool RelativeNames = false,
2092
    llvm::vfs::FileSystem &FS = *llvm::vfs::getRealFileSystem(),
2093
    llvm::Optional<llvm::StringRef> CurrentDir = llvm::None);
2094
2095
/// Mark all options not part of this category as cl::ReallyHidden.
2096
///
2097
/// \param Category the category of options to keep displaying
2098
///
2099
/// Some tools (like clang-format) like to be able to hide all options that are
2100
/// not specific to the tool. This function allows a tool to specify a single
2101
/// option category to display in the -help output.
2102
void HideUnrelatedOptions(cl::OptionCategory &Category,
2103
                          SubCommand &Sub = *TopLevelSubCommand);
2104
2105
/// Mark all options not part of the categories as cl::ReallyHidden.
2106
///
2107
/// \param Categories the categories of options to keep displaying.
2108
///
2109
/// Some tools (like clang-format) like to be able to hide all options that are
2110
/// not specific to the tool. This function allows a tool to specify a single
2111
/// option category to display in the -help output.
2112
void HideUnrelatedOptions(ArrayRef<const cl::OptionCategory *> Categories,
2113
                          SubCommand &Sub = *TopLevelSubCommand);
2114
2115
/// Reset all command line options to a state that looks as if they have
2116
/// never appeared on the command line.  This is useful for being able to parse
2117
/// a command line multiple times (especially useful for writing tests).
2118
void ResetAllOptionOccurrences();
2119
2120
/// Reset the command line parser back to its initial state.  This
2121
/// removes
2122
/// all options, categories, and subcommands and returns the parser to a state
2123
/// where no options are supported.
2124
void ResetCommandLineParser();
2125
2126
/// Parses `Arg` into the option handler `Handler`.
2127
bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i);
2128
2129
} // end namespace cl
2130
2131
} // end namespace llvm
2132
2133
#endif // LLVM_SUPPORT_COMMANDLINE_H