Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
StringRef.h
Go to the documentation of this file.
1//===- StringRef.h - Constant String Reference Wrapper ----------*- 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#ifndef LLVM_ADT_STRINGREF_H
10#define LLVM_ADT_STRINGREF_H
11
12#include "llvm/ADT/DenseMapInfo.h"
13#include "llvm/ADT/STLFunctionalExtras.h"
14#include "llvm/ADT/iterator_range.h"
15#include "llvm/Support/Compiler.h"
16#include <algorithm>
17#include <cassert>
18#include <cstddef>
19#include <cstring>
20#include <iterator>
21#include <limits>
22#include <string>
23#include <string_view>
24#include <type_traits>
25#include <utility>
26
27namespacellvm {
28
29classAPInt;
30classhash_code;
31template <typename T>classSmallVectorImpl;
32classStringRef;
33
34 /// Helper functions for StringRef::getAsInteger.
35boolgetAsUnsignedInteger(StringRef Str,unsigned Radix,
36unsignedlonglong &Result);
37
38boolgetAsSignedInteger(StringRef Str,unsigned Radix,longlong &Result);
39
40boolconsumeUnsignedInteger(StringRef &Str,unsigned Radix,
41unsignedlonglong &Result);
42boolconsumeSignedInteger(StringRef &Str,unsigned Radix,longlong &Result);
43
44 /// StringRef - Represent a constant reference to a string, i.e. a character
45 /// array and a length, which need not be null terminated.
46 ///
47 /// This class does not own the string data, it is expected to be used in
48 /// situations where the character data resides in some other buffer, whose
49 /// lifetime extends past that of the StringRef. For this reason, it is not in
50 /// general safe to store a StringRef.
51classLLVM_GSL_POINTERStringRef {
52public:
53staticconstexprsize_tnpos = ~size_t(0);
54
55usingiterator =constchar *;
56usingconst_iterator =constchar *;
57usingsize_type = size_t;
58usingvalue_type =char;
59usingreverse_iterator = std::reverse_iterator<iterator>;
60usingconst_reverse_iterator = std::reverse_iterator<const_iterator>;
61
62private:
63 /// The start of the string, in an external buffer.
64constchar *Data =nullptr;
65
66 /// The length of the string.
67size_tLength = 0;
68
69// Workaround memcmp issue with null pointers (undefined behavior)
70// by providing a specialized version
71staticint compareMemory(constchar *Lhs,constchar *Rhs,size_t Length) {
72if (Length == 0) {return 0; }
73 return ::memcmp(Lhs,Rhs,Length);
74 }
75
76public:
77 /// @name Constructors
78 /// @{
79
80 /// Construct an empty string ref.
81/*implicit*/StringRef() =default;
82
83 /// Disable conversion from nullptr. This prevents things like
84 /// if (S == nullptr)
85StringRef(std::nullptr_t) =delete;
86
87 /// Construct a string ref from a cstring.
88/*implicit*/constexprStringRef(constchar *StrLLVM_LIFETIME_BOUND)
89 : Data(Str),Length(Str ?
90// GCC 7 doesn't have constexpr char_traits. Fall back to __builtin_strlen.
91#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 8
92 __builtin_strlen(Str)
93#else
94std::char_traits<char>::length(Str)
95#endif
96 : 0) {
97 }
98
99 /// Construct a string ref from a pointer and length.
100/*implicit*/constexprStringRef(constchar *dataLLVM_LIFETIME_BOUND,
101size_t length)
102 : Data(data),Length(length) {}
103
104 /// Construct a string ref from an std::string.
105/*implicit*/StringRef(const std::string &Str)
106 : Data(Str.data()),Length(Str.length()) {}
107
108 /// Construct a string ref from an std::string_view.
109/*implicit*/constexprStringRef(std::string_view Str)
110 : Data(Str.data()),Length(Str.size()) {}
111
112 /// @}
113 /// @name Iterators
114 /// @{
115
116iteratorbegin() const{returndata(); }
117
118iteratorend() const{returndata() +size(); }
119
120reverse_iteratorrbegin() const{
121return std::make_reverse_iterator(end());
122 }
123
124reverse_iteratorrend() const{
125return std::make_reverse_iterator(begin());
126 }
127
128constunsignedchar *bytes_begin() const{
129returnreinterpret_cast<constunsignedchar *>(begin());
130 }
131constunsignedchar *bytes_end() const{
132returnreinterpret_cast<constunsignedchar *>(end());
133 }
134iterator_range<const unsigned char *>bytes() const{
135returnmake_range(bytes_begin(), bytes_end());
136 }
137
138 /// @}
139 /// @name String Operations
140 /// @{
141
142 /// data - Get a pointer to the start of the string (which may not be null
143 /// terminated).
144 [[nodiscard]]constexprconstchar *data() const{return Data; }
145
146 /// empty - Check if the string is empty.
147 [[nodiscard]]constexprboolempty() const{returnsize() == 0; }
148
149 /// size - Get the string size.
150 [[nodiscard]]constexprsize_tsize() const{returnLength; }
151
152 /// front - Get the first character in the string.
153 [[nodiscard]]charfront() const{
154assert(!empty());
155returndata()[0];
156 }
157
158 /// back - Get the last character in the string.
159 [[nodiscard]]charback() const{
160assert(!empty());
161returndata()[size() - 1];
162 }
163
164// copy - Allocate copy in Allocator and return StringRef to it.
165template <typename Allocator>
166 [[nodiscard]]StringRefcopy(Allocator &A) const{
167// Don't request a length 0 copy from the allocator.
168if (empty())
169returnStringRef();
170char *S =A.template Allocate<char>(size());
171 std::copy(begin(), end(), S);
172returnStringRef(S,size());
173 }
174
175 /// Check for string equality, ignoring case.
176 [[nodiscard]]boolequals_insensitive(StringRefRHS) const{
177returnsize() ==RHS.size() && compare_insensitive(RHS) == 0;
178 }
179
180 /// compare - Compare two strings; the result is negative, zero, or positive
181 /// if this string is lexicographically less than, equal to, or greater than
182 /// the \p RHS.
183 [[nodiscard]]intcompare(StringRefRHS) const{
184// Check the prefix for a mismatch.
185if (int Res =
186 compareMemory(data(),RHS.data(), std::min(size(),RHS.size())))
187return Res < 0 ? -1 : 1;
188
189// Otherwise the prefixes match, so we only need to check the lengths.
190if (size() ==RHS.size())
191return 0;
192returnsize() <RHS.size() ? -1 : 1;
193 }
194
195 /// Compare two strings, ignoring case.
196 [[nodiscard]]int compare_insensitive(StringRefRHS)const;
197
198 /// compare_numeric - Compare two strings, treating sequences of digits as
199 /// numbers.
200 [[nodiscard]]int compare_numeric(StringRefRHS)const;
201
202 /// Determine the edit distance between this string and another
203 /// string.
204 ///
205 /// \param Other the string to compare this string against.
206 ///
207 /// \param AllowReplacements whether to allow character
208 /// replacements (change one character into another) as a single
209 /// operation, rather than as two operations (an insertion and a
210 /// removal).
211 ///
212 /// \param MaxEditDistance If non-zero, the maximum edit distance that
213 /// this routine is allowed to compute. If the edit distance will exceed
214 /// that maximum, returns \c MaxEditDistance+1.
215 ///
216 /// \returns the minimum number of character insertions, removals,
217 /// or (if \p AllowReplacements is \c true) replacements needed to
218 /// transform one of the given strings into the other. If zero,
219 /// the strings are identical.
220 [[nodiscard]]unsigned edit_distance(StringRefOther,
221bool AllowReplacements =true,
222unsigned MaxEditDistance = 0)const;
223
224 [[nodiscard]]unsigned
225 edit_distance_insensitive(StringRefOther,bool AllowReplacements =true,
226unsigned MaxEditDistance = 0)const;
227
228 /// str - Get the contents as an std::string.
229 [[nodiscard]] std::stringstr() const{
230if (!data())
231return std::string();
232return std::string(data(),size());
233 }
234
235 /// @}
236 /// @name Operator Overloads
237 /// @{
238
239 [[nodiscard]]charoperator[](size_tIndex) const{
240assert(Index <size() &&"Invalid index!");
241returndata()[Index];
242 }
243
244 /// Disallow accidental assignment from a temporary std::string.
245 ///
246 /// The declaration here is extra complicated so that `stringRef = {}`
247 /// and `stringRef = "abc"` continue to select the move assignment operator.
248template <typename T>
249 std::enable_if_t<std::is_same<T, std::string>::value,StringRef> &
250operator=(T &&Str) =delete;
251
252 /// @}
253 /// @name Type Conversions
254 /// @{
255
256constexproperator std::string_view() const{
257return std::string_view(data(),size());
258 }
259
260 /// @}
261 /// @name String Predicates
262 /// @{
263
264 /// Check if this string starts with the given \p Prefix.
265 [[nodiscard]]boolstarts_with(StringRef Prefix) const{
266returnsize() >= Prefix.size() &&
267 compareMemory(data(), Prefix.data(), Prefix.size()) == 0;
268 }
269 [[nodiscard]]boolstarts_with(char Prefix) const{
270return !empty() && front() == Prefix;
271 }
272
273 /// Check if this string starts with the given \p Prefix, ignoring case.
274 [[nodiscard]]bool starts_with_insensitive(StringRef Prefix)const;
275
276 /// Check if this string ends with the given \p Suffix.
277 [[nodiscard]]boolends_with(StringRef Suffix) const{
278returnsize() >= Suffix.size() &&
279 compareMemory(end() - Suffix.size(), Suffix.data(),
280 Suffix.size()) == 0;
281 }
282 [[nodiscard]]boolends_with(char Suffix) const{
283return !empty() && back() == Suffix;
284 }
285
286 /// Check if this string ends with the given \p Suffix, ignoring case.
287 [[nodiscard]]bool ends_with_insensitive(StringRef Suffix)const;
288
289 /// @}
290 /// @name String Searching
291 /// @{
292
293 /// Search for the first character \p C in the string.
294 ///
295 /// \returns The index of the first occurrence of \p C, or npos if not
296 /// found.
297 [[nodiscard]]size_tfind(charC,size_tFrom = 0) const{
298return std::string_view(*this).find(C,From);
299 }
300
301 /// Search for the first character \p C in the string, ignoring case.
302 ///
303 /// \returns The index of the first occurrence of \p C, or npos if not
304 /// found.
305 [[nodiscard]]size_t find_insensitive(charC,size_tFrom = 0)const;
306
307 /// Search for the first character satisfying the predicate \p F
308 ///
309 /// \returns The index of the first character satisfying \p F starting from
310 /// \p From, or npos if not found.
311 [[nodiscard]]size_tfind_if(function_ref<bool(char)>F,
312size_tFrom = 0) const{
313StringRef S = drop_front(From);
314while (!S.empty()) {
315if (F(S.front()))
316returnsize() - S.size();
317 S = S.drop_front();
318 }
319returnnpos;
320 }
321
322 /// Search for the first character not satisfying the predicate \p F
323 ///
324 /// \returns The index of the first character not satisfying \p F starting
325 /// from \p From, or npos if not found.
326 [[nodiscard]]size_tfind_if_not(function_ref<bool(char)>F,
327size_tFrom = 0) const{
328returnfind_if([F](char c) {return !F(c); },From);
329 }
330
331 /// Search for the first string \p Str in the string.
332 ///
333 /// \returns The index of the first occurrence of \p Str, or npos if not
334 /// found.
335 [[nodiscard]]size_tfind(StringRef Str,size_tFrom = 0)const;
336
337 /// Search for the first string \p Str in the string, ignoring case.
338 ///
339 /// \returns The index of the first occurrence of \p Str, or npos if not
340 /// found.
341 [[nodiscard]]size_t find_insensitive(StringRef Str,size_tFrom = 0)const;
342
343 /// Search for the last character \p C in the string.
344 ///
345 /// \returns The index of the last occurrence of \p C, or npos if not
346 /// found.
347 [[nodiscard]]size_trfind(charC,size_tFrom =npos) const{
348size_tI = std::min(From,size());
349while (I) {
350 --I;
351if (data()[I] ==C)
352returnI;
353 }
354returnnpos;
355 }
356
357 /// Search for the last character \p C in the string, ignoring case.
358 ///
359 /// \returns The index of the last occurrence of \p C, or npos if not
360 /// found.
361 [[nodiscard]]size_t rfind_insensitive(charC,size_tFrom =npos)const;
362
363 /// Search for the last string \p Str in the string.
364 ///
365 /// \returns The index of the last occurrence of \p Str, or npos if not
366 /// found.
367 [[nodiscard]]size_t rfind(StringRef Str)const;
368
369 /// Search for the last string \p Str in the string, ignoring case.
370 ///
371 /// \returns The index of the last occurrence of \p Str, or npos if not
372 /// found.
373 [[nodiscard]]size_t rfind_insensitive(StringRef Str)const;
374
375 /// Find the first character in the string that is \p C, or npos if not
376 /// found. Same as find.
377 [[nodiscard]]size_tfind_first_of(charC,size_tFrom = 0) const{
378returnfind(C,From);
379 }
380
381 /// Find the first character in the string that is in \p Chars, or npos if
382 /// not found.
383 ///
384 /// Complexity: O(size() + Chars.size())
385 [[nodiscard]]size_t find_first_of(StringRef Chars,size_tFrom = 0)const;
386
387 /// Find the first character in the string that is not \p C or npos if not
388 /// found.
389 [[nodiscard]]size_t find_first_not_of(charC,size_tFrom = 0)const;
390
391 /// Find the first character in the string that is not in the string
392 /// \p Chars, or npos if not found.
393 ///
394 /// Complexity: O(size() + Chars.size())
395 [[nodiscard]]size_t find_first_not_of(StringRef Chars,
396size_tFrom = 0)const;
397
398 /// Find the last character in the string that is \p C, or npos if not
399 /// found.
400 [[nodiscard]]size_tfind_last_of(charC,size_tFrom =npos) const{
401return rfind(C,From);
402 }
403
404 /// Find the last character in the string that is in \p C, or npos if not
405 /// found.
406 ///
407 /// Complexity: O(size() + Chars.size())
408 [[nodiscard]]size_t find_last_of(StringRef Chars,
409size_tFrom =npos)const;
410
411 /// Find the last character in the string that is not \p C, or npos if not
412 /// found.
413 [[nodiscard]]size_t find_last_not_of(charC,size_tFrom =npos)const;
414
415 /// Find the last character in the string that is not in \p Chars, or
416 /// npos if not found.
417 ///
418 /// Complexity: O(size() + Chars.size())
419 [[nodiscard]]size_t find_last_not_of(StringRef Chars,
420size_tFrom =npos)const;
421
422 /// Return true if the given string is a substring of *this, and false
423 /// otherwise.
424 [[nodiscard]]boolcontains(StringRefOther) const{
425returnfind(Other) !=npos;
426 }
427
428 /// Return true if the given character is contained in *this, and false
429 /// otherwise.
430 [[nodiscard]]boolcontains(charC) const{
431return find_first_of(C) !=npos;
432 }
433
434 /// Return true if the given string is a substring of *this, and false
435 /// otherwise.
436 [[nodiscard]]boolcontains_insensitive(StringRefOther) const{
437return find_insensitive(Other) !=npos;
438 }
439
440 /// Return true if the given character is contained in *this, and false
441 /// otherwise.
442 [[nodiscard]]boolcontains_insensitive(charC) const{
443return find_insensitive(C) !=npos;
444 }
445
446 /// @}
447 /// @name Helpful Algorithms
448 /// @{
449
450 /// Return the number of occurrences of \p C in the string.
451 [[nodiscard]]size_tcount(charC) const{
452size_t Count = 0;
453for (size_tI = 0;I !=size(); ++I)
454if (data()[I] ==C)
455 ++Count;
456return Count;
457 }
458
459 /// Return the number of non-overlapped occurrences of \p Str in
460 /// the string.
461size_tcount(StringRef Str)const;
462
463 /// Parse the current string as an integer of the specified radix. If
464 /// \p Radix is specified as zero, this does radix autosensing using
465 /// extended C rules: 0 is octal, 0x is hex, 0b is binary.
466 ///
467 /// If the string is invalid or if only a subset of the string is valid,
468 /// this returns true to signify the error. The string is considered
469 /// erroneous if empty or if it overflows T.
470template <typename T>boolgetAsInteger(unsigned Radix,T &Result) const{
471ifconstexpr (std::numeric_limits<T>::is_signed) {
472longlong LLVal;
473if (getAsSignedInteger(*this, Radix, LLVal) ||
474static_cast<T>(LLVal) != LLVal)
475returntrue;
476 Result = LLVal;
477 }else {
478unsignedlonglong ULLVal;
479// The additional cast to unsigned long long is required to avoid the
480// Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type
481// 'unsigned __int64' when instantiating getAsInteger with T = bool.
482if (getAsUnsignedInteger(*this, Radix, ULLVal) ||
483static_cast<unsignedlonglong>(static_cast<T>(ULLVal)) != ULLVal)
484returntrue;
485 Result = ULLVal;
486 }
487returnfalse;
488 }
489
490 /// Parse the current string as an integer of the specified radix. If
491 /// \p Radix is specified as zero, this does radix autosensing using
492 /// extended C rules: 0 is octal, 0x is hex, 0b is binary.
493 ///
494 /// If the string does not begin with a number of the specified radix,
495 /// this returns true to signify the error. The string is considered
496 /// erroneous if empty or if it overflows T.
497 /// The portion of the string representing the discovered numeric value
498 /// is removed from the beginning of the string.
499template <typename T>boolconsumeInteger(unsigned Radix,T &Result) {
500ifconstexpr (std::numeric_limits<T>::is_signed) {
501longlong LLVal;
502if (consumeSignedInteger(*this, Radix, LLVal) ||
503static_cast<longlong>(static_cast<T>(LLVal)) != LLVal)
504returntrue;
505 Result = LLVal;
506 }else {
507unsignedlonglong ULLVal;
508if (consumeUnsignedInteger(*this, Radix, ULLVal) ||
509static_cast<unsignedlonglong>(static_cast<T>(ULLVal)) != ULLVal)
510returntrue;
511 Result = ULLVal;
512 }
513returnfalse;
514 }
515
516 /// Parse the current string as an integer of the specified \p Radix, or of
517 /// an autosensed radix if the \p Radix given is 0. The current value in
518 /// \p Result is discarded, and the storage is changed to be wide enough to
519 /// store the parsed integer.
520 ///
521 /// \returns true if the string does not solely consist of a valid
522 /// non-empty number in the appropriate base.
523 ///
524 /// APInt::fromString is superficially similar but assumes the
525 /// string is well-formed in the given radix.
526bool getAsInteger(unsigned Radix,APInt &Result)const;
527
528 /// Parse the current string as an integer of the specified \p Radix. If
529 /// \p Radix is specified as zero, this does radix autosensing using
530 /// extended C rules: 0 is octal, 0x is hex, 0b is binary.
531 ///
532 /// If the string does not begin with a number of the specified radix,
533 /// this returns true to signify the error. The string is considered
534 /// erroneous if empty.
535 /// The portion of the string representing the discovered numeric value
536 /// is removed from the beginning of the string.
537bool consumeInteger(unsigned Radix,APInt &Result);
538
539 /// Parse the current string as an IEEE double-precision floating
540 /// point value. The string must be a well-formed double.
541 ///
542 /// If \p AllowInexact is false, the function will fail if the string
543 /// cannot be represented exactly. Otherwise, the function only fails
544 /// in case of an overflow or underflow, or an invalid floating point
545 /// representation.
546bool getAsDouble(double &Result,bool AllowInexact =true)const;
547
548 /// @}
549 /// @name String Operations
550 /// @{
551
552// Convert the given ASCII string to lowercase.
553 [[nodiscard]] std::string lower()const;
554
555 /// Convert the given ASCII string to uppercase.
556 [[nodiscard]] std::string upper()const;
557
558 /// @}
559 /// @name Substring Operations
560 /// @{
561
562 /// Return a reference to the substring from [Start, Start + N).
563 ///
564 /// \param Start The index of the starting character in the substring; if
565 /// the index is npos or greater than the length of the string then the
566 /// empty substring will be returned.
567 ///
568 /// \param N The number of characters to included in the substring. If N
569 /// exceeds the number of characters remaining in the string, the string
570 /// suffix (starting with \p Start) will be returned.
571 [[nodiscard]]constexprStringRefsubstr(size_t Start,
572size_tN =npos) const{
573 Start = std::min(Start,size());
574returnStringRef(data() + Start, std::min(N,size() - Start));
575 }
576
577 /// Return a StringRef equal to 'this' but with only the first \p N
578 /// elements remaining. If \p N is greater than the length of the
579 /// string, the entire string is returned.
580 [[nodiscard]]StringReftake_front(size_tN = 1) const{
581if (N >=size())
582return *this;
583return drop_back(size() -N);
584 }
585
586 /// Return a StringRef equal to 'this' but with only the last \p N
587 /// elements remaining. If \p N is greater than the length of the
588 /// string, the entire string is returned.
589 [[nodiscard]]StringReftake_back(size_tN = 1) const{
590if (N >=size())
591return *this;
592return drop_front(size() -N);
593 }
594
595 /// Return the longest prefix of 'this' such that every character
596 /// in the prefix satisfies the given predicate.
597 [[nodiscard]]StringReftake_while(function_ref<bool(char)>F) const{
598returnsubstr(0,find_if_not(F));
599 }
600
601 /// Return the longest prefix of 'this' such that no character in
602 /// the prefix satisfies the given predicate.
603 [[nodiscard]]StringReftake_until(function_ref<bool(char)>F) const{
604returnsubstr(0,find_if(F));
605 }
606
607 /// Return a StringRef equal to 'this' but with the first \p N elements
608 /// dropped.
609 [[nodiscard]]StringRefdrop_front(size_tN = 1) const{
610assert(size() >=N &&"Dropping more elements than exist");
611returnsubstr(N);
612 }
613
614 /// Return a StringRef equal to 'this' but with the last \p N elements
615 /// dropped.
616 [[nodiscard]]StringRefdrop_back(size_tN = 1) const{
617assert(size() >=N &&"Dropping more elements than exist");
618returnsubstr(0,size()-N);
619 }
620
621 /// Return a StringRef equal to 'this', but with all characters satisfying
622 /// the given predicate dropped from the beginning of the string.
623 [[nodiscard]]StringRefdrop_while(function_ref<bool(char)>F) const{
624returnsubstr(find_if_not(F));
625 }
626
627 /// Return a StringRef equal to 'this', but with all characters not
628 /// satisfying the given predicate dropped from the beginning of the string.
629 [[nodiscard]]StringRefdrop_until(function_ref<bool(char)>F) const{
630returnsubstr(find_if(F));
631 }
632
633 /// Returns true if this StringRef has the given prefix and removes that
634 /// prefix.
635boolconsume_front(StringRef Prefix) {
636if (!starts_with(Prefix))
637returnfalse;
638
639 *this =substr(Prefix.size());
640returntrue;
641 }
642
643 /// Returns true if this StringRef has the given prefix, ignoring case,
644 /// and removes that prefix.
645boolconsume_front_insensitive(StringRef Prefix) {
646if (!starts_with_insensitive(Prefix))
647returnfalse;
648
649 *this =substr(Prefix.size());
650returntrue;
651 }
652
653 /// Returns true if this StringRef has the given suffix and removes that
654 /// suffix.
655boolconsume_back(StringRef Suffix) {
656if (!ends_with(Suffix))
657returnfalse;
658
659 *this =substr(0,size() - Suffix.size());
660returntrue;
661 }
662
663 /// Returns true if this StringRef has the given suffix, ignoring case,
664 /// and removes that suffix.
665boolconsume_back_insensitive(StringRef Suffix) {
666if (!ends_with_insensitive(Suffix))
667returnfalse;
668
669 *this =substr(0,size() - Suffix.size());
670returntrue;
671 }
672
673 /// Return a reference to the substring from [Start, End).
674 ///
675 /// \param Start The index of the starting character in the substring; if
676 /// the index is npos or greater than the length of the string then the
677 /// empty substring will be returned.
678 ///
679 /// \param End The index following the last character to include in the
680 /// substring. If this is npos or exceeds the number of characters
681 /// remaining in the string, the string suffix (starting with \p Start)
682 /// will be returned. If this is less than \p Start, an empty string will
683 /// be returned.
684 [[nodiscard]]StringRefslice(size_t Start,size_tEnd) const{
685 Start = std::min(Start,size());
686End = std::clamp(End, Start,size());
687returnStringRef(data() + Start,End - Start);
688 }
689
690 /// Split into two substrings around the first occurrence of a separator
691 /// character.
692 ///
693 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
694 /// such that (*this == LHS + Separator + RHS) is true and RHS is
695 /// maximal. If \p Separator is not in the string, then the result is a
696 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
697 ///
698 /// \param Separator The character to split on.
699 /// \returns The split substrings.
700 [[nodiscard]] std::pair<StringRef, StringRef>split(char Separator) const{
701return split(StringRef(&Separator, 1));
702 }
703
704 /// Split into two substrings around the first occurrence of a separator
705 /// string.
706 ///
707 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
708 /// such that (*this == LHS + Separator + RHS) is true and RHS is
709 /// maximal. If \p Separator is not in the string, then the result is a
710 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
711 ///
712 /// \param Separator - The string to split on.
713 /// \return - The split substrings.
714 [[nodiscard]] std::pair<StringRef, StringRef>
715split(StringRef Separator) const{
716size_tIdx =find(Separator);
717if (Idx ==npos)
718return std::make_pair(*this,StringRef());
719return std::make_pair(slice(0,Idx),substr(Idx + Separator.size()));
720 }
721
722 /// Split into two substrings around the last occurrence of a separator
723 /// string.
724 ///
725 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
726 /// such that (*this == LHS + Separator + RHS) is true and RHS is
727 /// minimal. If \p Separator is not in the string, then the result is a
728 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
729 ///
730 /// \param Separator - The string to split on.
731 /// \return - The split substrings.
732 [[nodiscard]] std::pair<StringRef, StringRef>
733rsplit(StringRef Separator) const{
734size_tIdx = rfind(Separator);
735if (Idx ==npos)
736return std::make_pair(*this,StringRef());
737return std::make_pair(slice(0,Idx),substr(Idx + Separator.size()));
738 }
739
740 /// Split into substrings around the occurrences of a separator string.
741 ///
742 /// Each substring is stored in \p A. If \p MaxSplit is >= 0, at most
743 /// \p MaxSplit splits are done and consequently <= \p MaxSplit + 1
744 /// elements are added to A.
745 /// If \p KeepEmpty is false, empty strings are not added to \p A. They
746 /// still count when considering \p MaxSplit
747 /// An useful invariant is that
748 /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
749 ///
750 /// \param A - Where to put the substrings.
751 /// \param Separator - The string to split on.
752 /// \param MaxSplit - The maximum number of times the string is split.
753 /// \param KeepEmpty - True if empty substring should be added.
754void split(SmallVectorImpl<StringRef> &A,
755StringRef Separator,int MaxSplit = -1,
756bool KeepEmpty =true)const;
757
758 /// Split into substrings around the occurrences of a separator character.
759 ///
760 /// Each substring is stored in \p A. If \p MaxSplit is >= 0, at most
761 /// \p MaxSplit splits are done and consequently <= \p MaxSplit + 1
762 /// elements are added to A.
763 /// If \p KeepEmpty is false, empty strings are not added to \p A. They
764 /// still count when considering \p MaxSplit
765 /// An useful invariant is that
766 /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
767 ///
768 /// \param A - Where to put the substrings.
769 /// \param Separator - The string to split on.
770 /// \param MaxSplit - The maximum number of times the string is split.
771 /// \param KeepEmpty - True if empty substring should be added.
772void split(SmallVectorImpl<StringRef> &A,char Separator,int MaxSplit = -1,
773bool KeepEmpty =true)const;
774
775 /// Split into two substrings around the last occurrence of a separator
776 /// character.
777 ///
778 /// If \p Separator is in the string, then the result is a pair (LHS, RHS)
779 /// such that (*this == LHS + Separator + RHS) is true and RHS is
780 /// minimal. If \p Separator is not in the string, then the result is a
781 /// pair (LHS, RHS) where (*this == LHS) and (RHS == "").
782 ///
783 /// \param Separator - The character to split on.
784 /// \return - The split substrings.
785 [[nodiscard]] std::pair<StringRef, StringRef>rsplit(char Separator) const{
786return rsplit(StringRef(&Separator, 1));
787 }
788
789 /// Return string with consecutive \p Char characters starting from the
790 /// the left removed.
791 [[nodiscard]]StringRefltrim(char Char) const{
792return drop_front(std::min(size(), find_first_not_of(Char)));
793 }
794
795 /// Return string with consecutive characters in \p Chars starting from
796 /// the left removed.
797 [[nodiscard]]StringRefltrim(StringRef Chars =" \t\n\v\f\r") const{
798return drop_front(std::min(size(), find_first_not_of(Chars)));
799 }
800
801 /// Return string with consecutive \p Char characters starting from the
802 /// right removed.
803 [[nodiscard]]StringRefrtrim(char Char) const{
804return drop_back(size() - std::min(size(), find_last_not_of(Char) + 1));
805 }
806
807 /// Return string with consecutive characters in \p Chars starting from
808 /// the right removed.
809 [[nodiscard]]StringRefrtrim(StringRef Chars =" \t\n\v\f\r") const{
810return drop_back(size() - std::min(size(), find_last_not_of(Chars) + 1));
811 }
812
813 /// Return string with consecutive \p Char characters starting from the
814 /// left and right removed.
815 [[nodiscard]]StringReftrim(char Char) const{
816return ltrim(Char).rtrim(Char);
817 }
818
819 /// Return string with consecutive characters in \p Chars starting from
820 /// the left and right removed.
821 [[nodiscard]]StringReftrim(StringRef Chars =" \t\n\v\f\r") const{
822return ltrim(Chars).rtrim(Chars);
823 }
824
825 /// Detect the line ending style of the string.
826 ///
827 /// If the string contains a line ending, return the line ending character
828 /// sequence that is detected. Otherwise return '\n' for unix line endings.
829 ///
830 /// \return - The line ending character sequence.
831 [[nodiscard]]StringRefdetectEOL() const{
832size_t Pos =find('\r');
833if (Pos ==npos) {
834// If there is no carriage return, assume unix
835return"\n";
836 }
837if (Pos + 1 <size() &&data()[Pos + 1] =='\n')
838return"\r\n";// Windows
839if (Pos > 0 &&data()[Pos - 1] =='\n')
840return"\n\r";// You monster!
841return"\r";// Classic Mac
842 }
843 /// @}
844 };
845
846 /// A wrapper around a string literal that serves as a proxy for constructing
847 /// global tables of StringRefs with the length computed at compile time.
848 /// In order to avoid the invocation of a global constructor, StringLiteral
849 /// should *only* be used in a constexpr context, as such:
850 ///
851 /// constexpr StringLiteral S("test");
852 ///
853classStringLiteral :publicStringRef {
854private:
855constexprStringLiteral(constchar *Str,size_tN) :StringRef(Str,N) {
856 }
857
858public:
859template <size_t N>
860constexprStringLiteral(constchar (&Str)[N])
861#if defined(__clang__) && __has_attribute(enable_if)
862#pragma clang diagnostic push
863#pragma clang diagnostic ignored "-Wgcc-compat"
864 __attribute((enable_if(__builtin_strlen(Str) ==N - 1,
865"invalid string literal")))
866#pragma clang diagnostic pop
867#endif
868 :StringRef(Str,N - 1) {
869 }
870
871// Explicit construction for strings like "foo\0bar".
872template <size_t N>
873staticconstexprStringLiteralwithInnerNUL(constchar (&Str)[N]) {
874returnStringLiteral(Str,N - 1);
875 }
876 };
877
878 /// @name StringRef Comparison Operators
879 /// @{
880
881inlinebooloperator==(StringRefLHS,StringRefRHS) {
882if (LHS.size() !=RHS.size())
883returnfalse;
884if (LHS.empty())
885returntrue;
886 return ::memcmp(LHS.data(),RHS.data(),LHS.size()) == 0;
887 }
888
889inlinebooloperator!=(StringRefLHS,StringRefRHS) {return !(LHS ==RHS); }
890
891inlinebooloperator<(StringRefLHS,StringRefRHS) {
892returnLHS.compare(RHS) < 0;
893 }
894
895inlinebooloperator<=(StringRefLHS,StringRefRHS) {
896returnLHS.compare(RHS) <= 0;
897 }
898
899inlinebooloperator>(StringRefLHS,StringRefRHS) {
900returnLHS.compare(RHS) > 0;
901 }
902
903inlinebooloperator>=(StringRefLHS,StringRefRHS) {
904returnLHS.compare(RHS) >= 0;
905 }
906
907inline std::string &operator+=(std::string &buffer,StringRefstring) {
908return buffer.append(string.data(),string.size());
909 }
910
911 /// @}
912
913 /// Compute a hash_code for a StringRef.
914 [[nodiscard]] hash_codehash_value(StringRef S);
915
916// Provide DenseMapInfo for StringRefs.
917template <>structDenseMapInfo<StringRef, void> {
918staticinlineStringRefgetEmptyKey() {
919returnStringRef(
920reinterpret_cast<constchar *>(~static_cast<uintptr_t>(0)), 0);
921 }
922
923staticinlineStringRefgetTombstoneKey() {
924returnStringRef(
925reinterpret_cast<constchar *>(~static_cast<uintptr_t>(1)), 0);
926 }
927
928staticunsignedgetHashValue(StringRef Val);
929
930staticboolisEqual(StringRefLHS,StringRefRHS) {
931if (RHS.data() == getEmptyKey().data())
932returnLHS.data() == getEmptyKey().data();
933if (RHS.data() == getTombstoneKey().data())
934returnLHS.data() == getTombstoneKey().data();
935returnLHS ==RHS;
936 }
937 };
938
939}// end namespace llvm
940
941#endif// LLVM_ADT_STRINGREF_H
From
BlockVerifier::State From
Definition:BlockVerifier.cpp:57
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
C
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
Compiler.h
LLVM_LIFETIME_BOUND
#define LLVM_LIFETIME_BOUND
Definition:Compiler.h:419
LLVM_GSL_POINTER
#define LLVM_GSL_POINTER
LLVM_GSL_POINTER - Apply this to non-owning classes like StringRef to enable lifetime warnings.
Definition:Compiler.h:413
npos
static constexpr size_t npos
Definition:DXContainerPSVInfo.cpp:19
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
DenseMapInfo.h
This file defines DenseMapInfo traits for DenseMap.
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
Other
std::optional< std::vector< StOtherPiece > > Other
Definition:ELFYAML.cpp:1315
End
bool End
Definition:ELF_riscv.cpp:480
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
else
else
Definition:PassBuilderBindings.cpp:89
if
if(PassOpts->AAPipeline)
Definition:PassBuilderBindings.cpp:64
Allocator
Basic Register Allocator
Definition:RegAllocBasic.cpp:146
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
STLFunctionalExtras.h
substr
static StringRef substr(StringRef Str, uint64_t Len)
Definition:SimplifyLibCalls.cpp:356
data
static Split data
Definition:StaticDataSplitter.cpp:176
starts_with
DEMANGLE_NAMESPACE_BEGIN bool starts_with(std::string_view self, char C) noexcept
Definition:StringViewExtras.h:24
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
T
char
llvm::APInt
Class for arbitrary precision integers.
Definition:APInt.h:78
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::StringLiteral
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition:StringRef.h:853
llvm::StringLiteral::StringLiteral
constexpr StringLiteral(const char(&Str)[N])
Definition:StringRef.h:860
llvm::StringLiteral::withInnerNUL
static constexpr StringLiteral withInnerNUL(const char(&Str)[N])
Definition:StringRef.h:873
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::trim
StringRef trim(StringRef Chars=" \t\n\v\f\r") const
Return string with consecutive characters in Chars starting from the left and right removed.
Definition:StringRef.h:821
llvm::StringRef::consume_back
bool consume_back(StringRef Suffix)
Returns true if this StringRef has the given suffix and removes that suffix.
Definition:StringRef.h:655
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::bytes
iterator_range< const unsigned char * > bytes() const
Definition:StringRef.h:134
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition:StringRef.h:229
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::bytes_end
const unsigned char * bytes_end() const
Definition:StringRef.h:131
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::starts_with
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition:StringRef.h:265
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition:StringRef.h:147
llvm::StringRef::const_reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition:StringRef.h:60
llvm::StringRef::contains_insensitive
bool contains_insensitive(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
Definition:StringRef.h:436
llvm::StringRef::take_while
StringRef take_while(function_ref< bool(char)> F) const
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predi...
Definition:StringRef.h:597
llvm::StringRef::ends_with
bool ends_with(char Suffix) const
Definition:StringRef.h:282
llvm::StringRef::operator[]
char operator[](size_t Index) const
Definition:StringRef.h:239
llvm::StringRef::drop_front
StringRef drop_front(size_t N=1) const
Return a StringRef equal to 'this' but with the first N elements dropped.
Definition:StringRef.h:609
llvm::StringRef::contains_insensitive
bool contains_insensitive(char C) const
Return true if the given character is contained in *this, and false otherwise.
Definition:StringRef.h:442
llvm::StringRef::begin
iterator begin() const
Definition:StringRef.h:116
llvm::StringRef::rsplit
std::pair< StringRef, StringRef > rsplit(char Separator) const
Split into two substrings around the last occurrence of a separator character.
Definition:StringRef.h:785
llvm::StringRef::drop_until
StringRef drop_until(function_ref< bool(char)> F) const
Return a StringRef equal to 'this', but with all characters not satisfying the given predicate droppe...
Definition:StringRef.h:629
llvm::StringRef::size_type
size_t size_type
Definition:StringRef.h:57
llvm::StringRef::back
char back() const
back - Get the last character in the string.
Definition:StringRef.h:159
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::front
char front() const
front - Get the first character in the string.
Definition:StringRef.h:153
llvm::StringRef::rbegin
reverse_iterator rbegin() const
Definition:StringRef.h:120
llvm::StringRef::StringRef
constexpr StringRef(const char *data LLVM_LIFETIME_BOUND, size_t length)
Construct a string ref from a pointer and length.
Definition:StringRef.h:100
llvm::StringRef::reverse_iterator
std::reverse_iterator< iterator > reverse_iterator
Definition:StringRef.h:59
llvm::StringRef::starts_with
bool starts_with(char Prefix) const
Definition:StringRef.h:269
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::ltrim
StringRef ltrim(char Char) const
Return string with consecutive Char characters starting from the the left removed.
Definition:StringRef.h:791
llvm::StringRef::contains
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
Definition:StringRef.h:424
llvm::StringRef::consume_front
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
Definition:StringRef.h:635
llvm::StringRef::detectEOL
StringRef detectEOL() const
Detect the line ending style of the string.
Definition:StringRef.h:831
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::StringRef
StringRef()=default
Construct an empty string ref.
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::rtrim
StringRef rtrim(char Char) const
Return string with consecutive Char characters starting from the right removed.
Definition:StringRef.h:803
llvm::StringRef::StringRef
constexpr StringRef(const char *Str LLVM_LIFETIME_BOUND)
Construct a string ref from a cstring.
Definition:StringRef.h:88
llvm::StringRef::contains
bool contains(char C) const
Return true if the given character is contained in *this, and false otherwise.
Definition:StringRef.h:430
llvm::StringRef::StringRef
StringRef(std::nullptr_t)=delete
Disable conversion from nullptr.
llvm::StringRef::take_back
StringRef take_back(size_t N=1) const
Return a StringRef equal to 'this' but with only the last N elements remaining.
Definition:StringRef.h:589
llvm::StringRef::take_front
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
Definition:StringRef.h:580
llvm::StringRef::take_until
StringRef take_until(function_ref< bool(char)> F) const
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicat...
Definition:StringRef.h:603
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::trim
StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
Definition:StringRef.h:815
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::consume_back_insensitive
bool consume_back_insensitive(StringRef Suffix)
Returns true if this StringRef has the given suffix, ignoring case, and removes that suffix.
Definition:StringRef.h:665
llvm::StringRef::copy
StringRef copy(Allocator &A) const
Definition:StringRef.h:166
llvm::StringRef::ends_with
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition:StringRef.h:277
llvm::StringRef::rsplit
std::pair< StringRef, StringRef > rsplit(StringRef Separator) const
Split into two substrings around the last occurrence of a separator string.
Definition:StringRef.h:733
llvm::StringRef::split
std::pair< StringRef, StringRef > split(StringRef Separator) const
Split into two substrings around the first occurrence of a separator string.
Definition:StringRef.h:715
llvm::StringRef::ltrim
StringRef ltrim(StringRef Chars=" \t\n\v\f\r") const
Return string with consecutive characters in Chars starting from the left removed.
Definition:StringRef.h:797
llvm::StringRef::operator=
std::enable_if_t< std::is_same< T, std::string >::value, StringRef > & operator=(T &&Str)=delete
Disallow accidental assignment from a temporary std::string.
llvm::StringRef::rtrim
StringRef rtrim(StringRef Chars=" \t\n\v\f\r") const
Return string with consecutive characters in Chars starting from the right removed.
Definition:StringRef.h:809
llvm::StringRef::drop_while
StringRef drop_while(function_ref< bool(char)> F) const
Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped fr...
Definition:StringRef.h:623
llvm::StringRef::bytes_begin
const unsigned char * bytes_begin() const
Definition:StringRef.h:128
llvm::StringRef::compare
int compare(StringRef RHS) const
compare - Compare two strings; the result is negative, zero, or positive if this string is lexicograp...
Definition:StringRef.h:183
llvm::StringRef::drop_back
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Definition:StringRef.h:616
llvm::StringRef::equals_insensitive
bool equals_insensitive(StringRef RHS) const
Check for string equality, ignoring case.
Definition:StringRef.h:176
llvm::StringRef::consume_front_insensitive
bool consume_front_insensitive(StringRef Prefix)
Returns true if this StringRef has the given prefix, ignoring case, and removes that prefix.
Definition:StringRef.h:645
llvm::StringRef::StringRef
StringRef(const std::string &Str)
Construct a string ref from an std::string.
Definition:StringRef.h:105
llvm::StringRef::rend
reverse_iterator rend() const
Definition:StringRef.h:124
llvm::StringRef::StringRef
constexpr StringRef(std::string_view Str)
Construct a string ref from an std::string_view.
Definition:StringRef.h:109
llvm::StringRef::find_if_not
size_t find_if_not(function_ref< bool(char)> F, size_t From=0) const
Search for the first character not satisfying the predicate F.
Definition:StringRef.h:326
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition:STLFunctionalExtras.h:37
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
iterator_range.h
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Length
@ Length
Definition:DWP.cpp:480
llvm::operator<
bool operator<(int64_t V1, const APSInt &V2)
Definition:APSInt.h:361
llvm::find
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1759
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::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition:STLExtras.h:1697
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition:APInt.h:2082
llvm::operator>=
bool operator>=(int64_t V1, const APSInt &V2)
Definition:APSInt.h:360
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition:iterator_range.h:77
llvm::operator+=
LLVM_ATTRIBUTE_ALWAYS_INLINE DynamicAPInt & operator+=(DynamicAPInt &A, int64_t B)
Definition:DynamicAPInt.h:518
llvm::operator==
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
Definition:AddressRanges.h:153
llvm::consumeUnsignedInteger
bool consumeUnsignedInteger(StringRef &Str, unsigned Radix, unsigned long long &Result)
Definition:StringRef.cpp:410
llvm::operator>
bool operator>(int64_t V1, const APSInt &V2)
Definition:APSInt.h:362
llvm::find_if_not
auto find_if_not(R &&Range, UnaryPredicate P)
Definition:STLExtras.h:1771
llvm::consumeSignedInteger
bool consumeSignedInteger(StringRef &Str, unsigned Radix, long long &Result)
Definition:StringRef.cpp:458
llvm::count
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
Definition:STLExtras.h:1938
llvm::find_if
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1766
llvm::getAsUnsignedInteger
bool getAsUnsignedInteger(StringRef Str, unsigned Radix, unsigned long long &Result)
Helper functions for StringRef::getAsInteger.
Definition:StringRef.cpp:488
llvm::operator<=
bool operator<=(int64_t V1, const APSInt &V2)
Definition:APSInt.h:359
std
Implement std::hash so that hash_code can be used in STL containers.
Definition:BitVector.h:858
N
#define N
llvm::DenseMapInfo< StringRef, void >::getEmptyKey
static StringRef getEmptyKey()
Definition:StringRef.h:918
llvm::DenseMapInfo< StringRef, void >::isEqual
static bool isEqual(StringRef LHS, StringRef RHS)
Definition:StringRef.h:930
llvm::DenseMapInfo< StringRef, void >::getHashValue
static unsigned getHashValue(StringRef Val)
llvm::DenseMapInfo< StringRef, void >::getTombstoneKey
static StringRef getTombstoneKey()
Definition:StringRef.h:923
llvm::DenseMapInfo
An information struct used to provide DenseMap with the various necessary components for a given valu...
Definition:DenseMapInfo.h:52

Generated on Thu Jul 17 2025 08:14:14 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp