used to avoid std::string allocations in common cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34232
91177308-0d34-0410-b5e6-
96231b3b80d8
void setName(const std::string &name);
void setName(const char *Name, unsigned NameLen);
+ void setName(const char *Name); // Takes a null-terminated string.
+
/// takeName - transfer the name from V to this value, setting V's name to
/// empty. It is an error to call V->takeName(V).
setName(&name[0], name.size());
}
+void Value::setName(const char *Name) {
+ setName(Name, Name ? strlen(Name) : 0);
+}
+
void Value::setName(const char *NameStr, unsigned NameLen) {
if (NameLen == 0 && !hasName()) return;
if (getType() != Type::VoidTy && "Cannot assign a name to void values!");