LLVM: include/llvm/Option/Arg.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_OPTION_ARG_H

15#define LLVM_OPTION_ARG_H

16

21#include

22

23namespace llvm {

24

26

28

30

31

32

33

34

36private:

37

39

40

41

42 const Arg *BaseArg;

43

44

46

47

48

49 unsigned Index;

50

51

52

53

54

55

56 mutable unsigned Claimed : 1;

57

58

59

60 unsigned IgnoredTargetSpecific : 1;

61

62

63 mutable unsigned OwnsValues : 1;

64

65

67

68

69

70

71 std::unique_ptr Alias;

72

73public:

75 const Arg *BaseArg = nullptr);

77 const char *Value0, const Arg *BaseArg = nullptr);

79 const char *Value0, const char *Value1,

80 const Arg *BaseArg = nullptr);

84

86

87

88

89

90

91

92

94

95 unsigned getIndex() const { return Index; }

96

97

98

99

100

102 return BaseArg ? *BaseArg : *this;

103 }

104 Arg &getBaseArg() { return BaseArg ? const_cast<Arg &>(*BaseArg) : *this; }

105 void setBaseArg(const Arg *BaseArg) { this->BaseArg = BaseArg; }

106

107

108

110 void setAlias(std::unique_ptr Alias) { this->Alias = std::move(Alias); }

111

114

117

119 return getBaseArg().IgnoredTargetSpecific;

120 }

122 getBaseArg().IgnoredTargetSpecific = true;

123 }

124

126

128 return Values[N];

129 }

130

133

137

138

140

141

142

143

144

145

147

150

151

152

153

154

156};

157

158}

159

160}

161

162#endif

This file defines the SmallVector class.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

LLVM Value Representation.

ArgList - Ordered collection of driver arguments.

LLVM_ABI void render(const ArgList &Args, ArgStringList &Output) const

Append the argument onto the given array as strings.

const Arg & getBaseArg() const

Return the base argument which generated this arg.

Definition Arg.h:101

bool containsValue(StringRef Value) const

Definition Arg.h:134

bool getOwnsValues() const

Definition Arg.h:112

void setAlias(std::unique_ptr< Arg > Alias)

Definition Arg.h:110

LLVM_ABI void print(raw_ostream &O) const

LLVM_ABI void renderAsInput(const ArgList &Args, ArgStringList &Output) const

Append the argument, render as an input, onto the given array as strings.

StringRef getSpelling() const

Returns the used prefix and name of the option: For --foo=bar, returns --foo=.

Definition Arg.h:93

LLVM_ABI Arg(const Option Opt, StringRef Spelling, unsigned Index, const Arg *BaseArg=nullptr)

SmallVectorImpl< const char * > & getValues()

Definition Arg.h:131

Arg & operator=(const Arg &)=delete

LLVM_ABI std::string getAsString(const ArgList &Args) const

Return a formatted version of the argument and its values, for diagnostics.

const Option & getOption() const

Definition Arg.h:85

Arg & getBaseArg()

Definition Arg.h:104

bool isClaimed() const

Definition Arg.h:115

void setOwnsValues(bool Value) const

Definition Arg.h:113

void ignoreTargetSpecific()

Definition Arg.h:121

void setBaseArg(const Arg *BaseArg)

Definition Arg.h:105

unsigned getNumValues() const

Definition Arg.h:125

unsigned getIndex() const

Definition Arg.h:95

LLVM_ABI void dump() const

const SmallVectorImpl< const char * > & getValues() const

Definition Arg.h:132

const Arg * getAlias() const

Args are converted to their unaliased form.

Definition Arg.h:109

const char * getValue(unsigned N=0) const

Definition Arg.h:127

void claim() const

Definition Arg.h:116

bool isIgnoredTargetSpecific() const

Definition Arg.h:118

Option - Abstract representation for a single form of driver argument.

This class implements an extremely fast bulk output stream that can only output to a stream.

SmallVector< const char *, 16 > ArgStringList

ArgStringList - Type used for constructing argv lists for subprocesses.

This is an optimization pass for GlobalISel generic memory operations.

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.