1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Add StringMap::lookup.

llvm-svn: 66750
This commit is contained in:
Daniel Dunbar 2009-03-12 01:16:06 +00:00
parent a63033a34c
commit a3c65dba44

View File

@ -303,6 +303,27 @@ public:
return find(key_start, key_start + Key.size());
}
/// lookup - Return the entry for the specified key, or a default
/// constructed value if no such entry exists.
ValueTy lookup(const char *KeyStart, const char *KeyEnd) const {
const_iterator it = find(KeyStart, KeyEnd);
if (it != end())
return it->second;
return ValueTy();
}
ValueTy lookup(const char *Key) const {
const_iterator it = find(Key);
if (it != end())
return it->second;
return ValueTy();
}
ValueTy lookup(const std::string &Key) const {
const_iterator it = find(Key);
if (it != end())
return it->second;
return ValueTy();
}
ValueTy& operator[](const char *Key) {
return GetOrCreateValue(Key, Key + strlen(Key)).getValue();
}