mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-18 01:17:46 +00:00
Change ValueSymbolTable to use raw_svector_ostream for string concatenation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79449 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ef01ab0973
commit
29c142077e
@ -43,16 +43,17 @@ void ValueSymbolTable::reinsertValue(Value* V) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, there is a naming conflict. Rename this value.
|
// Otherwise, there is a naming conflict. Rename this value.
|
||||||
SmallString<128> UniqueName(V->getName().begin(), V->getName().end());
|
SmallString<256> UniqueName(V->getName().begin(), V->getName().end());
|
||||||
|
|
||||||
// The name is too already used, just free it so we can allocate a new name.
|
// The name is too already used, just free it so we can allocate a new name.
|
||||||
V->Name->Destroy();
|
V->Name->Destroy();
|
||||||
|
|
||||||
unsigned BaseSize = UniqueName.size();
|
unsigned BaseSize = UniqueName.size();
|
||||||
while (1) {
|
while (1) {
|
||||||
// Trim any suffix off.
|
// Trim any suffix off and append the next number.
|
||||||
UniqueName.resize(BaseSize);
|
UniqueName.resize(BaseSize);
|
||||||
UniqueName.append_uint_32(++LastUnique);
|
raw_svector_ostream(UniqueName) << ++LastUnique;
|
||||||
|
|
||||||
// Try insert the vmap entry with this suffix.
|
// Try insert the vmap entry with this suffix.
|
||||||
ValueName &NewName =
|
ValueName &NewName =
|
||||||
vmap.GetOrCreateValue(StringRef(UniqueName.data(),
|
vmap.GetOrCreateValue(StringRef(UniqueName.data(),
|
||||||
@ -90,9 +91,9 @@ ValueName *ValueSymbolTable::createValueName(const StringRef &Name, Value *V) {
|
|||||||
SmallString<128> UniqueName(Name.begin(), Name.end());
|
SmallString<128> UniqueName(Name.begin(), Name.end());
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// Trim any suffix off.
|
// Trim any suffix off and append the next number.
|
||||||
UniqueName.resize(Name.size());
|
UniqueName.resize(Name.size());
|
||||||
UniqueName.append_uint_32(++LastUnique);
|
raw_svector_ostream(UniqueName) << ++LastUnique;
|
||||||
|
|
||||||
// Try insert the vmap entry with this suffix.
|
// Try insert the vmap entry with this suffix.
|
||||||
ValueName &NewName =
|
ValueName &NewName =
|
||||||
|
Loading…
Reference in New Issue
Block a user