Remove Value::setName(const char*, unsigned).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77100 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-07-26 00:34:27 +00:00
parent d1319ef308
commit 3f53fa9a51
4 changed files with 15 additions and 12 deletions

View File

@ -128,8 +128,11 @@ public:
StringRef getName() const { return StringRef(getNameStart(), getNameLen()); }
std::string getNameStr() const;
/// setName() - Change the name of the value, choosing a new unique name if
/// the provided name is taken.
///
/// \arg Name - The new name; or "" if the value's name should be removed.
void setName(const Twine &Name);
void setName(const char *Name, unsigned NameLen);
/// takeName - transfer the name from V to this value, setting V's name to

View File

@ -680,7 +680,7 @@ bool BitcodeReader::ParseValueSymbolTable() {
return Error("Invalid Value ID in VST_ENTRY record");
Value *V = ValueList[ValueID];
V->setName(&ValueName[0], ValueName.size());
V->setName(StringRef(ValueName.data(), ValueName.size()));
ValueName.clear();
break;
}
@ -691,7 +691,7 @@ bool BitcodeReader::ParseValueSymbolTable() {
if (BB == 0)
return Error("Invalid BB ID in VST_BBENTRY record");
BB->setName(&ValueName[0], ValueName.size());
BB->setName(StringRef(ValueName.data(), ValueName.size()));
ValueName.clear();
break;
}

View File

@ -170,13 +170,13 @@ std::string Value::getNameStr() const {
return getName().str();
}
void Value::setName(const Twine &Name) {
void Value::setName(const Twine &NewName) {
SmallString<32> NameData;
Name.toVector(NameData);
setName(NameData.begin(), NameData.size());
}
NewName.toVector(NameData);
const char *NameStr = NameData.data();
unsigned NameLen = NameData.size();
void Value::setName(const char *NameStr, unsigned NameLen) {
if (NameLen == 0 && !hasName()) return;
assert(getType() != Type::VoidTy && "Cannot assign a name to void values!");
@ -242,7 +242,7 @@ void Value::takeName(Value *V) {
if (getSymTab(this, ST)) {
// We can't set a name on this value, but we need to clear V's name if
// it has one.
if (V->hasName()) V->setName(0, 0);
if (V->hasName()) V->setName("");
return; // Cannot set a name on this value (e.g. constant).
}
@ -262,7 +262,7 @@ void Value::takeName(Value *V) {
if (!ST) {
if (getSymTab(this, ST)) {
// Clear V's name.
V->setName(0, 0);
V->setName("");
return; // Cannot set a name on this value (e.g. constant).
}
}

View File

@ -269,8 +269,8 @@ llvm::SplitFunctionsOutOfModule(Module *M,
I->setLinkage(GlobalValue::ExternalLinkage);
for (Module::global_iterator I = M->global_begin(), E = M->global_end();
I != E; ++I) {
if (I->hasName() && *I->getNameStart() == '\01')
I->setName(I->getNameStart()+1, I->getNameLen()-1);
if (I->hasName() && I->getName()[0] == '\01')
I->setName(I->getName().substr(1));
I->setLinkage(GlobalValue::ExternalLinkage);
}