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

39

40

41 template

43

44

45

46

47

49

50

54

55

56 void assign(std::initializer_list Refs) {

59 }

60

61

62

63

64

66

67

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

98

99

100

101

103

104

108

109

110

114

115

116

117

118

119

123

124

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

148

149

150

151

152

156

157

158

159

160

162

163

164

168

169

170

171

172

176

177

178

182

183

184

185

186

188 size_t From = 0) const {

190 }

191

192

193

198

199

200

201

202

207

208

209

210

211

212

214

215

216

218

219

220

221

222

223

224

225

226

227

228

229

230

231

236

237

238

239

240

241

242

243

244

245

246

248 return str().slice(Start, End);

249 }

250

251

252

253

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

277

286};

287

288}

289

290#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

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

This file defines the SmallVector class.

size_t rfind(StringRef Str) const

Search for the last string Str in the string.

Definition SmallString.h:161

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.

Definition SmallString.h:173

SmallString(StringRef S)

Initialize from a StringRef.

Definition SmallString.h:32

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.

Definition SmallString.h:203

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.

Definition SmallString.h:194

SmallString & operator=(StringRef RHS)

Definition SmallString.h:273

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

Assign from a list of StringRefs.

Definition SmallString.h:56

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.

Definition SmallString.h:137

bool ends_with(StringRef Suffix) const

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

Definition SmallString.h:125

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

Search for the first string Str in the string.

Definition SmallString.h:145

bool equals(StringRef RHS) const

Check for string equality.

Definition SmallString.h:92

size_t count(StringRef Str) const

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

Definition SmallString.h:217

StringRef slice(size_t Start, size_t End) const

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

Definition SmallString.h:247

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

Search for the last character C in the string.

Definition SmallString.h:153

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

Append from a list of StringRefs.

Definition SmallString.h:73

SmallString & operator+=(char C)

Definition SmallString.h:282

void assign(StringRef RHS)

Assign from a StringRef.

Definition SmallString.h:51

SmallString & operator+=(StringRef RHS)

Definition SmallString.h:278

bool equals_insensitive(StringRef RHS) const

Check for string equality, ignoring case.

Definition SmallString.h:95

int compare_numeric(StringRef RHS) const

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

Definition SmallString.h:111

int compare(StringRef RHS) const

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

Definition SmallString.h:102

bool starts_with(StringRef Prefix) const

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

Definition SmallString.h:120

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

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

Definition SmallString.h:232

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.

Definition SmallString.h:187

void append(StringRef RHS)

Append from a StringRef.

Definition SmallString.h:68

SmallString(ItTy S, ItTy E)

Initialize with a range.

Definition SmallString.h:42

int compare_insensitive(StringRef RHS) const

compare_insensitive - Compare two strings, ignoring case.

Definition SmallString.h:105

size_t count(char C) const

Return the number of occurrences of C in the string.

Definition SmallString.h:213

const char * c_str()

Definition SmallString.h:259

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.

Definition SmallString.h:165

SmallString(std::initializer_list< StringRef > Refs)

Initialize by concatenating a list of StringRefs.

Definition SmallString.h:35

StringRef str() const

Explicit conversion to StringRef.

Definition SmallString.h:254

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.

Definition SmallString.h:179

void resize_for_overwrite(size_type N)

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 char &Elt)

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.

static constexpr size_t npos

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.

LLVM_ABI 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.

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.

LLVM_ABI 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.

LLVM_ABI 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.