aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Value.cpp')
-rw-r--r--lib/VMCore/Value.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 71dec841f4..d020c399fd 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -20,6 +20,7 @@
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/ValueSymbolTable.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LeakDetector.h"
@@ -183,8 +184,10 @@ StringRef Value::getNameRef() const {
return StringRef(Name->getKeyData(), Name->getKeyLength());
}
-void Value::setName(const std::string &name) {
- setName(&name[0], name.size());
+void Value::setName(const Twine &Name) {
+ SmallString<32> NameData;
+ Name.toVector(NameData);
+ setName(NameData.begin(), NameData.size());
}
void Value::setName(const char *Name) {