summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/StringMap.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-06 10:58:06 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-06 10:58:06 +0000
commit2928c83b010f7cfdb0f819199d806f6942a7d995 (patch)
tree0c5a62b287e4c2c693330584a8f1d6024defde66 /include/llvm/ADT/StringMap.h
parentc128b3e74eaba34a8f6d2b8c3dc19861b9cbd901 (diff)
downloadllvm-2928c83b010f7cfdb0f819199d806f6942a7d995.tar.gz
llvm-2928c83b010f7cfdb0f819199d806f6942a7d995.tar.bz2
llvm-2928c83b010f7cfdb0f819199d806f6942a7d995.tar.xz
Pass StringRef by value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringMap.h')
-rw-r--r--include/llvm/ADT/StringMap.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h
index 73fd635ee2..86e8546adc 100644
--- a/include/llvm/ADT/StringMap.h
+++ b/include/llvm/ADT/StringMap.h
@@ -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);