LLVM: include/llvm/ADT/SmallString.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_ADT_SMALLSTRING_H

15#define LLVM_ADT_SMALLSTRING_H

16

19#include

20

21namespace llvm {

22

23

24

25template

27public:

28

30

31

33

34

35 SmallString(std::initializer_list Refs)

38 }

39

40

41 template

43

44

45

46

47

49

50

53 }

54

55

56 void assign(std::initializer_list Refs) {

59 }

60

61

62

63

64

66

67

70 }

71

72

73 void append(std::initializer_list Refs) {

74 size_t CurrentSize = this->size();

75 size_t SizeNeeded = CurrentSize;

77 SizeNeeded += Ref.size();

80 std::copy(Ref.begin(), Ref.end(), this->begin() + CurrentSize);

81 CurrentSize += Ref.size();

82 }

84 }

85

86

87

88

89

90

91

93

94

97 }

98

99

100

101

103

104

107 }

108

109

110

113 }

114

115

116

117

118

119

122 }

123

124

127 }

128

129

130

131

132

133

134

135

136

137 [[nodiscard]] size_t find(char C, size_t From = 0) const {

139 }

140

141

142

143

144

147 }

148

149

150

151

152

155 }

156

157

158

159

160

162

163

164

167 }

168

169

170

171

172

175 }

176

177

178

181 }

182

183

184

185

186

188 size_t From = 0) const {

190 }

191

192

193

197 }

198

199

200

201

202

206 }

207

208

209

210

211

212

214

215

216

218

219

220

221

222

223

224

225

226

227

228

229

230

231

235 }

236

237

238

239

240

241

242

243

244

245

246

249 }

250

251

252

253

256 }

257

258

262 return this->data();

263 }

264

265

267

268 explicit operator std::string() const {

269 return std::string(this->data(), this->size());

270 }

271

272

275 return *this;

276 }

277

280 return *this;

281 }

284 return *this;

285 }

286};

287

288}

289

290#endif

BlockVerifier::State From

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())

This file defines the SmallVector class.

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

size_t rfind(StringRef Str) const

Search for the last string Str in the string.

size_t find_first_of(StringRef Chars, size_t From=0) const

Find the first character in the string that is in Chars, or npos if not found.

SmallString(StringRef S)

Initialize from a StringRef.

size_t find_last_of(StringRef Chars, size_t From=StringRef::npos) const

Find the last character in the string that is in C, or npos if not found.

size_t find_last_of(char C, size_t From=StringRef::npos) const

Find the last character in the string that is C, or npos if not found.

SmallString & operator=(StringRef RHS)

void assign(std::initializer_list< StringRef > Refs)

Assign from a list of StringRefs.

SmallString()=default

Default ctor - Initialize to empty.

size_t find(char C, size_t From=0) const

find - Search for the first character C in the string.

bool ends_with(StringRef Suffix) const

ends_with - Check if this string ends with the given Suffix.

size_t find(StringRef Str, size_t From=0) const

Search for the first string Str in the string.

bool equals(StringRef RHS) const

Check for string equality.

size_t count(StringRef Str) const

Return the number of non-overlapped occurrences of Str in the string.

StringRef slice(size_t Start, size_t End) const

Return a reference to the substring from [Start, End).

size_t rfind(char C, size_t From=StringRef::npos) const

Search for the last character C in the string.

void append(std::initializer_list< StringRef > Refs)

Append from a list of StringRefs.

SmallString & operator+=(char C)

void assign(StringRef RHS)

Assign from a StringRef.

SmallString & operator+=(StringRef RHS)

bool equals_insensitive(StringRef RHS) const

Check for string equality, ignoring case.

int compare_numeric(StringRef RHS) const

compare_numeric - Compare two strings, treating sequences of digits as numbers.

int compare(StringRef RHS) const

compare - Compare two strings; the result is negative, zero, or positive if this string is lexicograp...

bool starts_with(StringRef Prefix) const

starts_with - Check if this string starts with the given Prefix.

StringRef substr(size_t Start, size_t N=StringRef::npos) const

Return a reference to the substring from [Start, Start + N).

size_t find_first_not_of(StringRef Chars, size_t From=0) const

Find the first character in the string that is not in the string Chars, or npos if not found.

void append(StringRef RHS)

Append from a StringRef.

SmallString(ItTy S, ItTy E)

Initialize with a range.

int compare_insensitive(StringRef RHS) const

compare_insensitive - Compare two strings, ignoring case.

size_t count(char C) const

Return the number of occurrences of C in the string.

size_t find_first_of(char C, size_t From=0) const

Find the first character in the string that is C, or npos if not found.

SmallString(std::initializer_list< StringRef > Refs)

Initialize by concatenating a list of StringRefs.

StringRef str() const

Explicit conversion to StringRef.

size_t find_first_not_of(char C, size_t From=0) const

Find the first character in the string that is not C or npos if not found.

void resize_for_overwrite(size_type N)

Like resize, but T is POD, the new values won't be initialized.

void assign(size_type NumElts, ValueParamT Elt)

void append(ItTy in_start, ItTy in_end)

Add the specified range to the end of the SmallVector.

void push_back(const T &Elt)

pointer data()

Return a pointer to the vector's buffer, even if empty().

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.

constexpr StringRef substr(size_t Start, size_t N=npos) const

Return a reference to the substring from [Start, Start + N).

bool starts_with(StringRef Prefix) const

Check if this string starts with the given Prefix.

StringRef slice(size_t Start, size_t End) const

Return a reference to the substring from [Start, End).

size_t find_last_of(char C, size_t From=npos) const

Find the last character in the string that is C, or npos if not found.

int compare_numeric(StringRef RHS) const

compare_numeric - Compare two strings, treating sequences of digits as numbers.

size_t find_first_of(char C, size_t From=0) const

Find the first character in the string that is C, or npos if not found.

size_t rfind(char C, size_t From=npos) const

Search for the last character C in the string.

size_t find(char C, size_t From=0) const

Search for the first character C in the string.

size_t count(char C) const

Return the number of occurrences of C in the string.

bool ends_with(StringRef Suffix) const

Check if this string ends with the given Suffix.

static constexpr size_t npos

int compare(StringRef RHS) const

compare - Compare two strings; the result is negative, zero, or positive if this string is lexicograp...

bool equals_insensitive(StringRef RHS) const

Check for string equality, ignoring case.

size_t find_first_not_of(char C, size_t From=0) const

Find the first character in the string that is not C or npos if not found.

int compare_insensitive(StringRef RHS) const

Compare two strings, ignoring case.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

@ Ref

The access may reference the value stored in memory.