mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
add a setName variant that takes a null-terminated string. This can be
used to avoid std::string allocations in common cases. llvm-svn: 34232
This commit is contained in:
parent
2f015c1ccf
commit
cc543b031e
@ -92,6 +92,8 @@ public:
|
||||
|
||||
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).
|
||||
|
@ -122,6 +122,10 @@ void Value::setName(const std::string &name) {
|
||||
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!");
|
||||
|
Loading…
Reference in New Issue
Block a user