summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/VMCore/Value.cpp')
-rw-r--r--llvm/lib/VMCore/Value.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index b3c0692c0e5..a78865224cd 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -178,6 +178,11 @@ std::string Value::getNameStr() const {
Name->getKeyData()+Name->getKeyLength());
}
+StringRef Value::getNameRef() const {
+ if (Name == 0) return StringRef();
+ return StringRef(Name->getKeyData(), Name->getKeyLength());
+}
+
void Value::setName(const std::string &name) {
setName(&name[0], name.size());
}
@@ -238,7 +243,7 @@ void Value::setName(const char *NameStr, unsigned NameLen) {
}
// Name is changing to something new.
- Name = ST->createValueName(NameStr, NameLen, this);
+ Name = ST->createValueName(StringRef(NameStr, NameLen), this);
}
OpenPOWER on IntegriCloud