mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
Pass StringRef by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -96,12 +96,12 @@ protected:
|
||||
/// specified bucket will be non-null. Otherwise, it will be null. In either
|
||||
/// case, the FullHashValue field of the bucket will be set to the hash value
|
||||
/// of the string.
|
||||
unsigned LookupBucketFor(const StringRef &Key);
|
||||
unsigned LookupBucketFor(StringRef Key);
|
||||
|
||||
/// FindKey - Look up the bucket that contains the specified key. If it exists
|
||||
/// in the map, return the bucket number of the key. Otherwise return -1.
|
||||
/// This does not modify the map.
|
||||
int FindKey(const StringRef &Key) const;
|
||||
int FindKey(StringRef Key) const;
|
||||
|
||||
/// RemoveKey - Remove the specified StringMapEntry from the table, but do not
|
||||
/// delete it. This aborts if the value isn't in the table.
|
||||
@@ -109,7 +109,7 @@ protected:
|
||||
|
||||
/// RemoveKey - Remove the StringMapEntry for the specified key from the
|
||||
/// table, returning it. If the key is not in the table, this returns null.
|
||||
StringMapEntryBase *RemoveKey(const StringRef &Key);
|
||||
StringMapEntryBase *RemoveKey(StringRef Key);
|
||||
private:
|
||||
void init(unsigned Size);
|
||||
public:
|
||||
@@ -282,13 +282,13 @@ public:
|
||||
return const_iterator(TheTable+NumBuckets, true);
|
||||
}
|
||||
|
||||
iterator find(const StringRef &Key) {
|
||||
iterator find(StringRef Key) {
|
||||
int Bucket = FindKey(Key);
|
||||
if (Bucket == -1) return end();
|
||||
return iterator(TheTable+Bucket);
|
||||
}
|
||||
|
||||
const_iterator find(const StringRef &Key) const {
|
||||
const_iterator find(StringRef Key) const {
|
||||
int Bucket = FindKey(Key);
|
||||
if (Bucket == -1) return end();
|
||||
return const_iterator(TheTable+Bucket);
|
||||
@@ -296,18 +296,18 @@ public:
|
||||
|
||||
/// lookup - Return the entry for the specified key, or a default
|
||||
/// constructed value if no such entry exists.
|
||||
ValueTy lookup(const StringRef &Key) const {
|
||||
ValueTy lookup(StringRef Key) const {
|
||||
const_iterator it = find(Key);
|
||||
if (it != end())
|
||||
return it->second;
|
||||
return ValueTy();
|
||||
}
|
||||
|
||||
ValueTy& operator[](const StringRef &Key) {
|
||||
ValueTy& operator[](StringRef Key) {
|
||||
return GetOrCreateValue(Key).getValue();
|
||||
}
|
||||
|
||||
size_type count(const StringRef &Key) const {
|
||||
size_type count(StringRef Key) const {
|
||||
return find(Key) == end() ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ public:
|
||||
/// exists, return it. Otherwise, default construct a value, insert it, and
|
||||
/// return.
|
||||
template <typename InitTy>
|
||||
StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key,
|
||||
StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key,
|
||||
InitTy Val) {
|
||||
unsigned BucketNo = LookupBucketFor(Key);
|
||||
ItemBucket &Bucket = TheTable[BucketNo];
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
return *NewItem;
|
||||
}
|
||||
|
||||
StringMapEntry<ValueTy> &GetOrCreateValue(const StringRef &Key) {
|
||||
StringMapEntry<ValueTy> &GetOrCreateValue(StringRef Key) {
|
||||
return GetOrCreateValue(Key, ValueTy());
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
V.Destroy(Allocator);
|
||||
}
|
||||
|
||||
bool erase(const StringRef &Key) {
|
||||
bool erase(StringRef Key) {
|
||||
iterator I = find(Key);
|
||||
if (I == end()) return false;
|
||||
erase(I);
|
||||
|
@@ -92,14 +92,14 @@ namespace llvm {
|
||||
|
||||
/// equals - Check for string equality, this is more efficient than
|
||||
/// compare() when the relative ordering of inequal strings isn't needed.
|
||||
bool equals(const StringRef &RHS) const {
|
||||
bool equals(StringRef RHS) const {
|
||||
return (Length == RHS.Length &&
|
||||
memcmp(Data, RHS.Data, RHS.Length) == 0);
|
||||
}
|
||||
|
||||
/// compare - Compare two strings; the result is -1, 0, or 1 if this string
|
||||
/// is lexicographically less than, equal to, or greater than the \arg RHS.
|
||||
int compare(const StringRef &RHS) const {
|
||||
int compare(StringRef RHS) const {
|
||||
// Check the prefix for a mismatch.
|
||||
if (int Res = memcmp(Data, RHS.Data, std::min(Length, RHS.Length)))
|
||||
return Res < 0 ? -1 : 1;
|
||||
@@ -135,12 +135,12 @@ namespace llvm {
|
||||
/// @{
|
||||
|
||||
/// startswith - Check if this string starts with the given \arg Prefix.
|
||||
bool startswith(const StringRef &Prefix) const {
|
||||
bool startswith(StringRef Prefix) const {
|
||||
return substr(0, Prefix.Length).equals(Prefix);
|
||||
}
|
||||
|
||||
/// endswith - Check if this string ends with the given \arg Suffix.
|
||||
bool endswith(const StringRef &Suffix) const {
|
||||
bool endswith(StringRef Suffix) const {
|
||||
return slice(size() - Suffix.Length, size()).equals(Suffix);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace llvm {
|
||||
///
|
||||
/// \return - The index of the first occurence of \arg Str, or npos if not
|
||||
/// found.
|
||||
size_t find(const StringRef &Str) const;
|
||||
size_t find(StringRef Str) const;
|
||||
|
||||
/// rfind - Search for the last character \arg C in the string.
|
||||
///
|
||||
@@ -184,7 +184,7 @@ namespace llvm {
|
||||
///
|
||||
/// \return - The index of the last occurence of \arg Str, or npos if not
|
||||
/// found.
|
||||
size_t rfind(const StringRef &Str) const;
|
||||
size_t rfind(StringRef Str) const;
|
||||
|
||||
/// find_first_of - Find the first instance of the specified character or
|
||||
/// return npos if not in string. Same as find.
|
||||
@@ -213,7 +213,7 @@ namespace llvm {
|
||||
|
||||
/// count - Return the number of non-overlapped occurrences of \arg Str in
|
||||
/// the string.
|
||||
size_t count(const StringRef &Str) const;
|
||||
size_t count(StringRef Str) const;
|
||||
|
||||
/// getAsInteger - Parse the current string as an integer of the specified
|
||||
/// radix. If Radix is specified as zero, this does radix autosensing using
|
||||
@@ -304,27 +304,27 @@ namespace llvm {
|
||||
/// @name StringRef Comparison Operators
|
||||
/// @{
|
||||
|
||||
inline bool operator==(const StringRef &LHS, const StringRef &RHS) {
|
||||
inline bool operator==(StringRef LHS, StringRef RHS) {
|
||||
return LHS.equals(RHS);
|
||||
}
|
||||
|
||||
inline bool operator!=(const StringRef &LHS, const StringRef &RHS) {
|
||||
inline bool operator!=(StringRef LHS, StringRef RHS) {
|
||||
return !(LHS == RHS);
|
||||
}
|
||||
|
||||
inline bool operator<(const StringRef &LHS, const StringRef &RHS) {
|
||||
inline bool operator<(StringRef LHS, StringRef RHS) {
|
||||
return LHS.compare(RHS) == -1;
|
||||
}
|
||||
|
||||
inline bool operator<=(const StringRef &LHS, const StringRef &RHS) {
|
||||
inline bool operator<=(StringRef LHS, StringRef RHS) {
|
||||
return LHS.compare(RHS) != 1;
|
||||
}
|
||||
|
||||
inline bool operator>(const StringRef &LHS, const StringRef &RHS) {
|
||||
inline bool operator>(StringRef LHS, StringRef RHS) {
|
||||
return LHS.compare(RHS) == 1;
|
||||
}
|
||||
|
||||
inline bool operator>=(const StringRef &LHS, const StringRef &RHS) {
|
||||
inline bool operator>=(StringRef LHS, StringRef RHS) {
|
||||
return LHS.compare(RHS) != -1;
|
||||
}
|
||||
|
||||
|
@@ -218,23 +218,23 @@ public:
|
||||
|
||||
/// setArchName - Set the architecture (first) component of the
|
||||
/// triple by name.
|
||||
void setArchName(const StringRef &Str);
|
||||
void setArchName(StringRef Str);
|
||||
|
||||
/// setVendorName - Set the vendor (second) component of the triple
|
||||
/// by name.
|
||||
void setVendorName(const StringRef &Str);
|
||||
void setVendorName(StringRef Str);
|
||||
|
||||
/// setOSName - Set the operating system (third) component of the
|
||||
/// triple by name.
|
||||
void setOSName(const StringRef &Str);
|
||||
void setOSName(StringRef Str);
|
||||
|
||||
/// setEnvironmentName - Set the optional environment (fourth)
|
||||
/// component of the triple by name.
|
||||
void setEnvironmentName(const StringRef &Str);
|
||||
void setEnvironmentName(StringRef Str);
|
||||
|
||||
/// setOSAndEnvironmentName - Set the operating system and optional
|
||||
/// environment components with a single string.
|
||||
void setOSAndEnvironmentName(const StringRef &Str);
|
||||
void setOSAndEnvironmentName(StringRef Str);
|
||||
|
||||
/// @}
|
||||
/// @name Static helpers for IDs.
|
||||
@@ -265,12 +265,12 @@ public:
|
||||
|
||||
/// getArchTypeForLLVMName - The canonical type for the given LLVM
|
||||
/// architecture name (e.g., "x86").
|
||||
static ArchType getArchTypeForLLVMName(const StringRef &Str);
|
||||
static ArchType getArchTypeForLLVMName(StringRef Str);
|
||||
|
||||
/// getArchTypeForDarwinArchName - Get the architecture type for a "Darwin"
|
||||
/// architecture name, for example as accepted by "gcc -arch" (see also
|
||||
/// arch(3)).
|
||||
static ArchType getArchTypeForDarwinArchName(const StringRef &Str);
|
||||
static ArchType getArchTypeForDarwinArchName(StringRef Str);
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
Reference in New Issue
Block a user