Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
StringRef.cpp
Go to the documentation of this file.
1//===-- StringRef.cpp - Lightweight String References ---------------------===//
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#include "llvm/ADT/StringRef.h"
10#include "llvm/ADT/APFloat.h"
11#include "llvm/ADT/APInt.h"
12#include "llvm/ADT/Hashing.h"
13#include "llvm/ADT/StringExtras.h"
14#include "llvm/ADT/edit_distance.h"
15#include "llvm/Support/Error.h"
16#include <bitset>
17
18using namespacellvm;
19
20// MSVC emits references to this into the translation units which reference it.
21#ifndef _MSC_VER
22constexprsize_tStringRef::npos;
23#endif
24
25// strncasecmp() is not available on non-POSIX systems, so define an
26// alternative function here.
27staticintascii_strncasecmp(constchar *LHS,constchar *RHS,size_tLength) {
28for (size_tI = 0;I <Length; ++I) {
29unsignedchar LHC = toLower(LHS[I]);
30unsignedchar RHC = toLower(RHS[I]);
31if (LHC != RHC)
32return LHC < RHC ? -1 : 1;
33 }
34return 0;
35}
36
37intStringRef::compare_insensitive(StringRef RHS) const{
38if (int Res =
39ascii_strncasecmp(data(),RHS.data(), std::min(size(),RHS.size())))
40return Res;
41if (size() ==RHS.size())
42return 0;
43returnsize() <RHS.size() ? -1 : 1;
44}
45
46boolStringRef::starts_with_insensitive(StringRef Prefix) const{
47returnsize() >= Prefix.size() &&
48ascii_strncasecmp(data(), Prefix.data(), Prefix.size()) == 0;
49}
50
51boolStringRef::ends_with_insensitive(StringRef Suffix) const{
52returnsize() >= Suffix.size() &&
53ascii_strncasecmp(end() - Suffix.size(), Suffix.data(),
54 Suffix.size()) == 0;
55}
56
57size_tStringRef::find_insensitive(charC,size_tFrom) const{
58char L = toLower(C);
59returnfind_if([L](charD) {return toLower(D) == L; },From);
60}
61
62/// compare_numeric - Compare strings, handle embedded numbers.
63intStringRef::compare_numeric(StringRef RHS) const{
64for (size_tI = 0, E = std::min(size(),RHS.size());I != E; ++I) {
65// Check for sequences of digits.
66if (isDigit(data()[I]) &&isDigit(RHS.data()[I])) {
67// The longer sequence of numbers is considered larger.
68// This doesn't really handle prefixed zeros well.
69size_t J;
70for (J =I + 1; J != E + 1; ++J) {
71bool ld = J <size() &&isDigit(data()[J]);
72bool rd = J <RHS.size() &&isDigit(RHS.data()[J]);
73if (ld != rd)
74return rd ? -1 : 1;
75if (!rd)
76break;
77 }
78// The two number sequences have the same length (J-I), just memcmp them.
79if (int Res = compareMemory(data() +I,RHS.data() +I, J -I))
80return Res < 0 ? -1 : 1;
81// Identical number sequences, continue search after the numbers.
82I = J - 1;
83continue;
84 }
85if (data()[I] !=RHS.data()[I])
86return (unsignedchar)data()[I] < (unsignedchar)RHS.data()[I] ? -1 : 1;
87 }
88if (size() ==RHS.size())
89return 0;
90returnsize() <RHS.size() ? -1 : 1;
91}
92
93// Compute the edit distance between the two given strings.
94unsignedStringRef::edit_distance(llvm::StringRefOther,
95bool AllowReplacements,
96unsigned MaxEditDistance) const{
97returnllvm::ComputeEditDistance(ArrayRef(data(),size()),
98ArrayRef(Other.data(),Other.size()),
99 AllowReplacements, MaxEditDistance);
100}
101
102unsignedllvm::StringRef::edit_distance_insensitive(
103StringRefOther,bool AllowReplacements,unsigned MaxEditDistance) const{
104returnllvm::ComputeMappedEditDistance(
105ArrayRef(data(),size()),ArrayRef(Other.data(),Other.size()),
106 llvm::toLower, AllowReplacements, MaxEditDistance);
107}
108
109//===----------------------------------------------------------------------===//
110// String Operations
111//===----------------------------------------------------------------------===//
112
113std::stringStringRef::lower() const{
114return std::string(map_iterator(begin(), toLower),
115map_iterator(end(), toLower));
116}
117
118std::stringStringRef::upper() const{
119return std::string(map_iterator(begin(), toUpper),
120map_iterator(end(), toUpper));
121}
122
123//===----------------------------------------------------------------------===//
124// String Searching
125//===----------------------------------------------------------------------===//
126
127
128/// find - Search for the first string \arg Str in the string.
129///
130/// \return - The index of the first occurrence of \arg Str, or npos if not
131/// found.
132size_tStringRef::find(StringRef Str,size_tFrom) const{
133if (From >size())
134returnnpos;
135
136constchar *Start =data() +From;
137size_tSize =size() -From;
138
139constchar *Needle = Str.data();
140size_tN = Str.size();
141if (N == 0)
142returnFrom;
143if (Size <N)
144returnnpos;
145if (N == 1) {
146constchar *Ptr = (constchar *)::memchr(Start, Needle[0],Size);
147returnPtr ==nullptr ?npos :Ptr -data();
148 }
149
150constchar *Stop = Start + (Size -N + 1);
151
152if (N == 2) {
153// Provide a fast path for newline finding (CRLF case) in InclusionRewriter.
154// Not the most optimized strategy, but getting memcmp inlined should be
155// good enough.
156do {
157if (std::memcmp(Start, Needle, 2) == 0)
158return Start -data();
159 ++Start;
160 }while (Start < Stop);
161returnnpos;
162 }
163
164// For short haystacks or unsupported needles fall back to the naive algorithm
165if (Size < 16 || N > 255) {
166do {
167if (std::memcmp(Start, Needle,N) == 0)
168return Start -data();
169 ++Start;
170 }while (Start < Stop);
171returnnpos;
172 }
173
174// Build the bad char heuristic table, with uint8_t to reduce cache thrashing.
175uint8_t BadCharSkip[256];
176 std::memset(BadCharSkip,N, 256);
177for (unsigned i = 0; i !=N-1; ++i)
178 BadCharSkip[(uint8_t)Str[i]] =N-1-i;
179
180do {
181uint8_tLast = Start[N - 1];
182if (LLVM_UNLIKELY(Last == (uint8_t)Needle[N - 1]))
183if (std::memcmp(Start, Needle,N - 1) == 0)
184return Start -data();
185
186// Otherwise skip the appropriate number of bytes.
187 Start += BadCharSkip[Last];
188 }while (Start < Stop);
189
190returnnpos;
191}
192
193size_tStringRef::find_insensitive(StringRef Str,size_tFrom) const{
194StringRef This =substr(From);
195while (This.size() >= Str.size()) {
196if (This.starts_with_insensitive(Str))
197returnFrom;
198 This = This.drop_front();
199 ++From;
200 }
201returnnpos;
202}
203
204size_tStringRef::rfind_insensitive(charC,size_tFrom) const{
205From = std::min(From,size());
206size_t i =From;
207while (i != 0) {
208 --i;
209if (toLower(data()[i]) == toLower(C))
210return i;
211 }
212returnnpos;
213}
214
215/// rfind - Search for the last string \arg Str in the string.
216///
217/// \return - The index of the last occurrence of \arg Str, or npos if not
218/// found.
219size_tStringRef::rfind(StringRef Str) const{
220return std::string_view(*this).rfind(Str);
221}
222
223size_tStringRef::rfind_insensitive(StringRef Str) const{
224size_tN = Str.size();
225if (N >size())
226returnnpos;
227for (size_t i =size() -N + 1, e = 0; i != e;) {
228 --i;
229if (substr(i,N).equals_insensitive(Str))
230return i;
231 }
232returnnpos;
233}
234
235/// find_first_of - Find the first character in the string that is in \arg
236/// Chars, or npos if not found.
237///
238/// Note: O(size() + Chars.size())
239StringRef::size_typeStringRef::find_first_of(StringRef Chars,
240size_tFrom) const{
241 std::bitset<1 << CHAR_BIT> CharBits;
242for (charC : Chars)
243 CharBits.set((unsignedchar)C);
244
245for (size_type i = std::min(From,size()), e =size(); i != e; ++i)
246if (CharBits.test((unsignedchar)data()[i]))
247return i;
248returnnpos;
249}
250
251/// find_first_not_of - Find the first character in the string that is not
252/// \arg C or npos if not found.
253StringRef::size_typeStringRef::find_first_not_of(charC,size_tFrom) const{
254return std::string_view(*this).find_first_not_of(C,From);
255}
256
257/// find_first_not_of - Find the first character in the string that is not
258/// in the string \arg Chars, or npos if not found.
259///
260/// Note: O(size() + Chars.size())
261StringRef::size_typeStringRef::find_first_not_of(StringRef Chars,
262size_tFrom) const{
263 std::bitset<1 << CHAR_BIT> CharBits;
264for (charC : Chars)
265 CharBits.set((unsignedchar)C);
266
267for (size_type i = std::min(From,size()), e =size(); i != e; ++i)
268if (!CharBits.test((unsignedchar)data()[i]))
269return i;
270returnnpos;
271}
272
273/// find_last_of - Find the last character in the string that is in \arg C,
274/// or npos if not found.
275///
276/// Note: O(size() + Chars.size())
277StringRef::size_typeStringRef::find_last_of(StringRef Chars,
278size_tFrom) const{
279 std::bitset<1 << CHAR_BIT> CharBits;
280for (charC : Chars)
281 CharBits.set((unsignedchar)C);
282
283for (size_type i = std::min(From,size()) - 1, e = -1; i != e; --i)
284if (CharBits.test((unsignedchar)data()[i]))
285return i;
286returnnpos;
287}
288
289/// find_last_not_of - Find the last character in the string that is not
290/// \arg C, or npos if not found.
291StringRef::size_typeStringRef::find_last_not_of(charC,size_tFrom) const{
292for (size_type i = std::min(From,size()) - 1, e = -1; i != e; --i)
293if (data()[i] !=C)
294return i;
295returnnpos;
296}
297
298/// find_last_not_of - Find the last character in the string that is not in
299/// \arg Chars, or npos if not found.
300///
301/// Note: O(size() + Chars.size())
302StringRef::size_typeStringRef::find_last_not_of(StringRef Chars,
303size_tFrom) const{
304 std::bitset<1 << CHAR_BIT> CharBits;
305for (charC : Chars)
306 CharBits.set((unsignedchar)C);
307
308for (size_type i = std::min(From,size()) - 1, e = -1; i != e; --i)
309if (!CharBits.test((unsignedchar)data()[i]))
310return i;
311returnnpos;
312}
313
314voidStringRef::split(SmallVectorImpl<StringRef> &A,
315StringRef Separator,int MaxSplit,
316bool KeepEmpty) const{
317StringRef S = *this;
318
319// Count down from MaxSplit. When MaxSplit is -1, this will just split
320// "forever". This doesn't support splitting more than 2^31 times
321// intentionally; if we ever want that we can make MaxSplit a 64-bit integer
322// but that seems unlikely to be useful.
323while (MaxSplit-- != 0) {
324size_tIdx = S.find(Separator);
325if (Idx ==npos)
326break;
327
328// Push this split.
329if (KeepEmpty ||Idx > 0)
330A.push_back(S.slice(0,Idx));
331
332// Jump forward.
333 S = S.substr(Idx + Separator.size());
334 }
335
336// Push the tail.
337if (KeepEmpty || !S.empty())
338A.push_back(S);
339}
340
341voidStringRef::split(SmallVectorImpl<StringRef> &A,char Separator,
342int MaxSplit,bool KeepEmpty) const{
343StringRef S = *this;
344
345// Count down from MaxSplit. When MaxSplit is -1, this will just split
346// "forever". This doesn't support splitting more than 2^31 times
347// intentionally; if we ever want that we can make MaxSplit a 64-bit integer
348// but that seems unlikely to be useful.
349while (MaxSplit-- != 0) {
350size_tIdx = S.find(Separator);
351if (Idx ==npos)
352break;
353
354// Push this split.
355if (KeepEmpty ||Idx > 0)
356A.push_back(S.slice(0,Idx));
357
358// Jump forward.
359 S = S.substr(Idx + 1);
360 }
361
362// Push the tail.
363if (KeepEmpty || !S.empty())
364A.push_back(S);
365}
366
367//===----------------------------------------------------------------------===//
368// Helpful Algorithms
369//===----------------------------------------------------------------------===//
370
371/// count - Return the number of non-overlapped occurrences of \arg Str in
372/// the string.
373size_tStringRef::count(StringRef Str) const{
374size_t Count = 0;
375size_t Pos = 0;
376size_tN = Str.size();
377// TODO: For an empty `Str` we return 0 for legacy reasons. Consider changing
378// this to `Length + 1` which is more in-line with the function
379// description.
380if (!N)
381return 0;
382while ((Pos =find(Str, Pos)) !=npos) {
383 ++Count;
384 Pos +=N;
385 }
386return Count;
387}
388
389staticunsignedGetAutoSenseRadix(StringRef &Str) {
390if (Str.empty())
391return 10;
392
393if (Str.consume_front_insensitive("0x"))
394return 16;
395
396if (Str.consume_front_insensitive("0b"))
397return 2;
398
399if (Str.consume_front("0o"))
400return 8;
401
402if (Str[0] =='0' && Str.size() > 1 &&isDigit(Str[1])) {
403 Str = Str.substr(1);
404return 8;
405 }
406
407return 10;
408}
409
410boolllvm::consumeUnsignedInteger(StringRef &Str,unsigned Radix,
411unsignedlonglong &Result) {
412// Autosense radix if not specified.
413if (Radix == 0)
414 Radix =GetAutoSenseRadix(Str);
415
416// Empty strings (after the radix autosense) are invalid.
417if (Str.empty())returntrue;
418
419// Parse all the bytes of the string given this radix. Watch for overflow.
420StringRef Str2 = Str;
421 Result = 0;
422while (!Str2.empty()) {
423unsigned CharVal;
424if (Str2[0] >='0' && Str2[0] <='9')
425 CharVal = Str2[0] -'0';
426elseif (Str2[0] >='a' && Str2[0] <='z')
427 CharVal = Str2[0] -'a' + 10;
428elseif (Str2[0] >='A' && Str2[0] <='Z')
429 CharVal = Str2[0] -'A' + 10;
430else
431break;
432
433// If the parsed value is larger than the integer radix, we cannot
434// consume any more characters.
435if (CharVal >= Radix)
436break;
437
438// Add in this character.
439unsignedlonglong PrevResult = Result;
440 Result = Result * Radix + CharVal;
441
442// Check for overflow by shifting back and seeing if bits were lost.
443if (Result / Radix < PrevResult)
444returntrue;
445
446 Str2 = Str2.substr(1);
447 }
448
449// We consider the operation a failure if no characters were consumed
450// successfully.
451if (Str.size() == Str2.size())
452returntrue;
453
454 Str = Str2;
455returnfalse;
456}
457
458boolllvm::consumeSignedInteger(StringRef &Str,unsigned Radix,
459longlong &Result) {
460unsignedlonglong ULLVal;
461
462// Handle positive strings first.
463if (!Str.starts_with("-")) {
464if (consumeUnsignedInteger(Str, Radix, ULLVal) ||
465// Check for value so large it overflows a signed value.
466 (longlong)ULLVal < 0)
467returntrue;
468 Result = ULLVal;
469returnfalse;
470 }
471
472// Get the positive part of the value.
473StringRef Str2 = Str.drop_front(1);
474if (consumeUnsignedInteger(Str2, Radix, ULLVal) ||
475// Reject values so large they'd overflow as negative signed, but allow
476// "-0". This negates the unsigned so that the negative isn't undefined
477// on signed overflow.
478 (longlong)-ULLVal > 0)
479returntrue;
480
481 Str = Str2;
482 Result = -ULLVal;
483returnfalse;
484}
485
486/// GetAsUnsignedInteger - Workhorse method that converts a integer character
487/// sequence of radix up to 36 to an unsigned long long value.
488boolllvm::getAsUnsignedInteger(StringRef Str,unsigned Radix,
489unsignedlonglong &Result) {
490if (consumeUnsignedInteger(Str, Radix, Result))
491returntrue;
492
493// For getAsUnsignedInteger, we require the whole string to be consumed or
494// else we consider it a failure.
495return !Str.empty();
496}
497
498boolllvm::getAsSignedInteger(StringRef Str,unsigned Radix,
499longlong &Result) {
500if (consumeSignedInteger(Str, Radix, Result))
501returntrue;
502
503// For getAsSignedInteger, we require the whole string to be consumed or else
504// we consider it a failure.
505return !Str.empty();
506}
507
508boolStringRef::consumeInteger(unsigned Radix,APInt &Result) {
509StringRef Str = *this;
510
511// Autosense radix if not specified.
512if (Radix == 0)
513 Radix =GetAutoSenseRadix(Str);
514
515assert(Radix > 1 && Radix <= 36);
516
517// Empty strings (after the radix autosense) are invalid.
518if (Str.empty())returntrue;
519
520// Skip leading zeroes. This can be a significant improvement if
521// it means we don't need > 64 bits.
522 Str = Str.ltrim('0');
523
524// If it was nothing but zeroes....
525if (Str.empty()) {
526 Result =APInt(64, 0);
527 *this = Str;
528returnfalse;
529 }
530
531// (Over-)estimate the required number of bits.
532unsigned Log2Radix = 0;
533while ((1U << Log2Radix) < Radix) Log2Radix++;
534bool IsPowerOf2Radix = ((1U << Log2Radix) == Radix);
535
536unsignedBitWidth = Log2Radix * Str.size();
537if (BitWidth < Result.getBitWidth())
538BitWidth = Result.getBitWidth();// don't shrink the result
539elseif (BitWidth > Result.getBitWidth())
540 Result = Result.zext(BitWidth);
541
542APInt RadixAP, CharAP;// unused unless !IsPowerOf2Radix
543if (!IsPowerOf2Radix) {
544// These must have the same bit-width as Result.
545 RadixAP =APInt(BitWidth, Radix);
546 CharAP =APInt(BitWidth, 0);
547 }
548
549// Parse all the bytes of the string given this radix.
550 Result = 0;
551while (!Str.empty()) {
552unsigned CharVal;
553if (Str[0] >='0' && Str[0] <='9')
554 CharVal = Str[0]-'0';
555elseif (Str[0] >='a' && Str[0] <='z')
556 CharVal = Str[0]-'a'+10;
557elseif (Str[0] >='A' && Str[0] <='Z')
558 CharVal = Str[0]-'A'+10;
559else
560break;
561
562// If the parsed value is larger than the integer radix, the string is
563// invalid.
564if (CharVal >= Radix)
565break;
566
567// Add in this character.
568if (IsPowerOf2Radix) {
569 Result <<= Log2Radix;
570 Result |= CharVal;
571 }else {
572 Result *= RadixAP;
573 CharAP = CharVal;
574 Result += CharAP;
575 }
576
577 Str = Str.substr(1);
578 }
579
580// We consider the operation a failure if no characters were consumed
581// successfully.
582if (size() == Str.size())
583returntrue;
584
585 *this = Str;
586returnfalse;
587}
588
589boolStringRef::getAsInteger(unsigned Radix,APInt &Result) const{
590StringRef Str = *this;
591if (Str.consumeInteger(Radix, Result))
592returntrue;
593
594// For getAsInteger, we require the whole string to be consumed or else we
595// consider it a failure.
596return !Str.empty();
597}
598
599boolStringRef::getAsDouble(double &Result,bool AllowInexact) const{
600APFloatF(0.0);
601auto StatusOrErr =F.convertFromString(*this,APFloat::rmNearestTiesToEven);
602if (errorToBool(StatusOrErr.takeError()))
603returntrue;
604
605APFloat::opStatusStatus = *StatusOrErr;
606if (Status !=APFloat::opOK) {
607if (!AllowInexact || !(Status &APFloat::opInexact))
608returntrue;
609 }
610
611 Result =F.convertToDouble();
612returnfalse;
613}
614
615// Implementation of StringRef hashing.
616hash_codellvm::hash_value(StringRef S) {
617returnhash_combine_range(S.begin(), S.end());
618}
619
620unsignedDenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
621assert(Val.data() != getEmptyKey().data() &&
622"Cannot hash the empty key!");
623assert(Val.data() != getTombstoneKey().data() &&
624"Cannot hash the tombstone key!");
625return (unsigned)(hash_value(Val));
626}
APFloat.h
This file declares a class to represent arbitrary precision floating point values and provide a varie...
APInt.h
This file implements a class to represent arbitrary precision integral constant values and operations...
From
BlockVerifier::State From
Definition:BlockVerifier.cpp:57
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
LLVM_UNLIKELY
#define LLVM_UNLIKELY(EXPR)
Definition:Compiler.h:320
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
Hashing.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
isDigit
static bool isDigit(const char C)
Definition:RustDemangle.cpp:170
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
data
static Split data
Definition:StaticDataSplitter.cpp:176
StringExtras.h
This file contains some functions that are useful when dealing with strings.
GetAutoSenseRadix
static unsigned GetAutoSenseRadix(StringRef &Str)
Definition:StringRef.cpp:389
ascii_strncasecmp
static int ascii_strncasecmp(const char *LHS, const char *RHS, size_t Length)
Definition:StringRef.cpp:27
StringRef.h
Ptr
@ Ptr
Definition:TargetLibraryInfo.cpp:77
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
char
llvm::APFloat
Definition:APFloat.h:904
llvm::APInt
Class for arbitrary precision integers.
Definition:APInt.h:78
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::StringRef::split
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Definition:StringRef.h:700
llvm::StringRef::find_last_not_of
size_t find_last_not_of(char C, size_t From=npos) const
Find the last character in the string that is not C, or npos if not found.
Definition:StringRef.cpp:291
llvm::StringRef::consumeInteger
bool consumeInteger(unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
Definition:StringRef.h:499
llvm::StringRef::getAsInteger
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Definition:StringRef.h:470
llvm::StringRef::getAsDouble
bool getAsDouble(double &Result, bool AllowInexact=true) const
Parse the current string as an IEEE double-precision floating point value.
Definition:StringRef.cpp:599
llvm::StringRef::find_if
size_t find_if(function_ref< bool(char)> F, size_t From=0) const
Search for the first character satisfying the predicate F.
Definition:StringRef.h:311
llvm::StringRef::substr
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
Definition:StringRef.h:571
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition:StringRef.h:147
llvm::StringRef::starts_with_insensitive
bool starts_with_insensitive(StringRef Prefix) const
Check if this string starts with the given Prefix, ignoring case.
Definition:StringRef.cpp:46
llvm::StringRef::begin
iterator begin() const
Definition:StringRef.h:116
llvm::StringRef::upper
std::string upper() const
Convert the given ASCII string to uppercase.
Definition:StringRef.cpp:118
llvm::StringRef::edit_distance
unsigned edit_distance(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
Determine the edit distance between this string and another string.
Definition:StringRef.cpp:94
llvm::StringRef::size_type
size_t size_type
Definition:StringRef.h:57
llvm::StringRef::slice
StringRef slice(size_t Start, size_t End) const
Return a reference to the substring from [Start, End).
Definition:StringRef.h:684
llvm::StringRef::size
constexpr size_t size() const
size - Get the string size.
Definition:StringRef.h:150
llvm::StringRef::find_last_of
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.
Definition:StringRef.h:400
llvm::StringRef::data
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition:StringRef.h:144
llvm::StringRef::compare_numeric
int compare_numeric(StringRef RHS) const
compare_numeric - Compare two strings, treating sequences of digits as numbers.
Definition:StringRef.cpp:63
llvm::StringRef::find_first_of
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:StringRef.h:377
llvm::StringRef::rfind
size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
Definition:StringRef.h:347
llvm::StringRef::end
iterator end() const
Definition:StringRef.h:118
llvm::StringRef::find
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Definition:StringRef.h:297
llvm::StringRef::rfind_insensitive
size_t rfind_insensitive(char C, size_t From=npos) const
Search for the last character C in the string, ignoring case.
Definition:StringRef.cpp:204
llvm::StringRef::lower
std::string lower() const
Definition:StringRef.cpp:113
llvm::StringRef::find_insensitive
size_t find_insensitive(char C, size_t From=0) const
Search for the first character C in the string, ignoring case.
Definition:StringRef.cpp:57
llvm::StringRef::count
size_t count(char C) const
Return the number of occurrences of C in the string.
Definition:StringRef.h:451
llvm::StringRef::npos
static constexpr size_t npos
Definition:StringRef.h:53
llvm::StringRef::equals_insensitive
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
Definition:StringRef.h:176
llvm::StringRef::ends_with_insensitive
bool ends_with_insensitive(StringRef Suffix) const
Check if this string ends with the given Suffix, ignoring case.
Definition:StringRef.cpp:51
llvm::StringRef::find_first_not_of
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:StringRef.cpp:253
llvm::StringRef::compare_insensitive
int compare_insensitive(StringRef RHS) const
Compare two strings, ignoring case.
Definition:StringRef.cpp:37
llvm::StringRef::edit_distance_insensitive
unsigned edit_distance_insensitive(StringRef Other, bool AllowReplacements=true, unsigned MaxEditDistance=0) const
Definition:StringRef.cpp:102
llvm::hash_code
An opaque object representing a hash code.
Definition:Hashing.h:75
uint8_t
edit_distance.h
This file defines a Levenshtein distance function that works for any two sequences,...
Error.h
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::errorToBool
bool errorToBool(Error Err)
Helper for converting an Error to a bool.
Definition:Error.h:1099
llvm::Length
@ Length
Definition:DWP.cpp:480
llvm::getAsSignedInteger
bool getAsSignedInteger(StringRef Str, unsigned Radix, long long &Result)
Definition:StringRef.cpp:498
llvm::hash_value
hash_code hash_value(const FixedPointSemantics &Val)
Definition:APFixedPoint.h:136
llvm::map_iterator
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
Definition:STLExtras.h:372
llvm::consumeUnsignedInteger
bool consumeUnsignedInteger(StringRef &Str, unsigned Radix, unsigned long long &Result)
Definition:StringRef.cpp:410
llvm::ComputeEditDistance
unsigned ComputeEditDistance(ArrayRef< T > FromArray, ArrayRef< T > ToArray, bool AllowReplacements=true, unsigned MaxEditDistance=0)
Definition:edit_distance.h:106
llvm::IRMemLocation::Other
@ Other
Any other memory.
llvm::consumeSignedInteger
bool consumeSignedInteger(StringRef &Str, unsigned Radix, long long &Result)
Definition:StringRef.cpp:458
llvm::BitWidth
constexpr unsigned BitWidth
Definition:BitmaskEnum.h:217
llvm::PseudoProbeReservedId::Last
@ Last
llvm::getAsUnsignedInteger
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
Definition:StringRef.cpp:488
llvm::ComputeMappedEditDistance
unsigned ComputeMappedEditDistance(ArrayRef< T > FromArray, ArrayRef< T > ToArray, Functor Map, bool AllowReplacements=true, unsigned MaxEditDistance=0)
Determine the edit distance between two sequences.
Definition:edit_distance.h:45
llvm::hash_combine_range
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition:Hashing.h:468
N
#define N
Status
Definition:SIModeRegister.cpp:29
llvm::APFloatBase::rmNearestTiesToEven
static constexpr roundingMode rmNearestTiesToEven
Definition:APFloat.h:302
llvm::APFloatBase::opStatus
opStatus
IEEE-754R 7: Default exception handling.
Definition:APFloat.h:318
llvm::APFloatBase::opOK
@ opOK
Definition:APFloat.h:319
llvm::APFloatBase::opInexact
@ opInexact
Definition:APFloat.h:324
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition:DenseMapInfo.h:52

Generated on Fri Jul 18 2025 12:55:20 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp