diff options
| -rw-r--r-- | llvm/include/llvm/ADT/StringMap.h | 21 | 
1 files changed, 21 insertions, 0 deletions
| diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h index 08418ee3c1e..f5394750f25 100644 --- a/llvm/include/llvm/ADT/StringMap.h +++ b/llvm/include/llvm/ADT/StringMap.h @@ -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();    } | 

