// lookup a value - Returns null on failure...
//
Value *ValueSymbolTable::lookup(const std::string &Name) const {
- const_iterator VI = vmap.find(&Name[0], &Name[Name.size()]);
+ const_iterator VI = vmap.find(Name);
if (VI != vmap.end()) // We found the symbol
return VI->getValue();
return 0;
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;
UniqueName.resize(BaseSize);
UniqueName.append_uint_32(++LastUnique);
// Try insert the vmap entry with this suffix.
- ValueName &NewName = vmap.GetOrCreateValue(&UniqueName[0],
- &UniqueName[UniqueName.size()]);
+ ValueName &NewName =
+ vmap.GetOrCreateValue(StringRef(UniqueName.data(),
+ UniqueName.size()));
if (NewName.getValue() == 0) {
// Newly inserted name. Success!
NewName.setValue(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() << ": "
UniqueName.append_uint_32(++LastUnique);
// Try insert the vmap entry with this suffix.
- ValueName &NewName = vmap.GetOrCreateValue(&UniqueName[0],
- &UniqueName[UniqueName.size()]);
+ ValueName &NewName =
+ vmap.GetOrCreateValue(StringRef(UniqueName.data(),
+ UniqueName.size()));
if (NewName.getValue() == 0) {
// Newly inserted name. Success!
NewName.setValue(V);