diff options
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/LLVMContextImpl.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/ValueSymbolTable.cpp | 15 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/VMCore/LLVMContextImpl.cpp b/lib/VMCore/LLVMContextImpl.cpp index 79b33c1..1c5af77 100644 --- a/lib/VMCore/LLVMContextImpl.cpp +++ b/lib/VMCore/LLVMContextImpl.cpp @@ -397,7 +397,7 @@ MDString *LLVMContextImpl::getMDString(const char *StrBegin, unsigned StrLength) { sys::SmartScopedWriter<true> Writer(ConstantsLock); StringMapEntry<MDString *> &Entry = - MDStringCache.GetOrCreateValue(StrBegin, StrBegin + StrLength); + MDStringCache.GetOrCreateValue(StringRef(StrBegin, StrLength)); MDString *&S = Entry.getValue(); if (!S) S = new MDString(Entry.getKeyData(), Entry.getKeyLength()); @@ -460,8 +460,8 @@ Constant *LLVMContextImpl::getConstantArray(const ArrayType *Ty, void LLVMContextImpl::erase(MDString *M) { sys::SmartScopedWriter<true> Writer(ConstantsLock); - MDStringCache.erase(MDStringCache.find(M->StrBegin, - M->StrBegin + M->length())); + MDStringCache.erase(MDStringCache.find(StringRef(M->StrBegin, + M->length()))); } void LLVMContextImpl::erase(MDNode *M) { diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp index eee18a1..8d3514b 100644 --- a/lib/VMCore/ValueSymbolTable.cpp +++ b/lib/VMCore/ValueSymbolTable.cpp @@ -33,7 +33,7 @@ ValueSymbolTable::~ValueSymbolTable() { // lookup a value - Returns null on failure... // Value *ValueSymbolTable::lookup(const std::string &Name) const { - const_iterator VI = vmap.find(Name.data(), Name.data() + Name.size()); + const_iterator VI = vmap.find(Name); if (VI != vmap.end()) // We found the symbol return VI->getValue(); return 0; @@ -41,7 +41,8 @@ Value *ValueSymbolTable::lookup(const std::string &Name) const { Value *ValueSymbolTable::lookup(const char *NameBegin, const char *NameEnd) const { - const_iterator VI = vmap.find(NameBegin, NameEnd); + // FIXME: ValueSymbolTable should move to a StringRef based API. + const_iterator VI = vmap.find(StringRef(NameBegin, NameEnd - NameBegin)); if (VI != vmap.end()) // We found the symbol return VI->getValue(); return 0; @@ -71,8 +72,8 @@ void ValueSymbolTable::reinsertValue(Value* V) { UniqueName.append_uint_32(++LastUnique); // Try insert the vmap entry with this suffix. ValueName &NewName = - vmap.GetOrCreateValue(UniqueName.data(), - UniqueName.data() + UniqueName.size()); + vmap.GetOrCreateValue(StringRef(UniqueName.data(), + UniqueName.size())); if (NewName.getValue() == 0) { // Newly inserted name. Success! NewName.setValue(V); @@ -95,7 +96,7 @@ void ValueSymbolTable::removeValueName(ValueName *V) { ValueName *ValueSymbolTable::createValueName(const char *NameStart, unsigned NameLen, Value *V) { // In the common case, the name is not already in the symbol table. - ValueName &Entry = vmap.GetOrCreateValue(NameStart, NameStart+NameLen); + ValueName &Entry = vmap.GetOrCreateValue(StringRef(NameStart, NameLen)); if (Entry.getValue() == 0) { Entry.setValue(V); //DEBUG(DOUT << " Inserted value: " << Entry.getKeyData() << ": " @@ -113,8 +114,8 @@ ValueName *ValueSymbolTable::createValueName(const char *NameStart, // Try insert the vmap entry with this suffix. ValueName &NewName = - vmap.GetOrCreateValue(UniqueName.data(), - UniqueName.data() + UniqueName.size()); + vmap.GetOrCreateValue(StringRef(UniqueName.data(), + UniqueName.size())); if (NewName.getValue() == 0) { // Newly inserted name. Success! NewName.setValue(V); |