[llvm-commits] [llvm] r77100 - in /llvm/trunk: include/llvm/Value.h lib/Bitcode/Reader/BitcodeReader.cpp lib/VMCore/Value.cpp tools/bugpoint/ExtractFunction.cpp
Daniel Dunbar
daniel at zuster.org
Sat Jul 25 17:34:38 PDT 2009
Author: ddunbar
Date: Sat Jul 25 19:34:27 2009
New Revision: 77100
URL: http://llvm.org/viewvc/llvm-project?rev=77100&view=rev
Log:
Remove Value::setName(const char*, unsigned).
Modified:
llvm/trunk/include/llvm/Value.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/VMCore/Value.cpp
llvm/trunk/tools/bugpoint/ExtractFunction.cpp
Modified: llvm/trunk/include/llvm/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=77100&r1=77099&r2=77100&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Value.h (original)
+++ llvm/trunk/include/llvm/Value.h Sat Jul 25 19:34:27 2009
@@ -128,8 +128,11 @@
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
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=77100&r1=77099&r2=77100&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sat Jul 25 19:34:27 2009
@@ -680,7 +680,7 @@
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 @@
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;
}
Modified: llvm/trunk/lib/VMCore/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=77100&r1=77099&r2=77100&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Value.cpp (original)
+++ llvm/trunk/lib/VMCore/Value.cpp Sat Jul 25 19:34:27 2009
@@ -170,13 +170,13 @@
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 @@
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 @@
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).
}
}
Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=77100&r1=77099&r2=77100&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original)
+++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Sat Jul 25 19:34:27 2009
@@ -269,8 +269,8 @@
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);
}
More information about the llvm-commits
mailing list