#include "llvm/AbstractTypeUser.h"
#include "llvm/Use.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include <iosfwd>
#include <string>
/// construct a string, they are very expensive and should be avoided.
std::string getName() const { return getNameStr(); }
std::string getNameStr() const;
-
+ StringRef getNameRef() const;
void setName(const std::string &name);
void setName(const char *Name, unsigned NameLen);
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());
}
}
// Name is changing to something new.
- Name = ST->createValueName(NameStr, NameLen, this);
+ Name = ST->createValueName(StringRef(NameStr, NameLen), this);
}