add a method for comparing to see if a value has a specified name.
llvm-svn: 50465
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index a61a1a0..cf696fe 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -136,6 +136,13 @@
return Name ? Name->getKeyLength() : 0;
}
+/// isName - Return true if this value has the name specified by the provided
+/// nul terminated string.
+bool Value::isName(const char *N) const {
+ unsigned InLen = strlen(N);
+ return InLen = getNameLen() && memcmp(getNameStart(), N, InLen) == 0;
+}
+
std::string Value::getNameStr() const {
if (Name == 0) return "";