summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-30 03:55:40 +0000
committerChris Lattner <sabre@nondot.org>2008-04-30 03:55:40 +0000
commit12e6d200597bb5d61ed56ccf9d70a52614956a70 (patch)
tree5d6ca20313ef2e50aa43dd5a894e762f49186eb0 /lib
parentea8650cddfb4ec7a532409ea918173e050cb40e8 (diff)
downloadllvm-12e6d200597bb5d61ed56ccf9d70a52614956a70.tar.gz
llvm-12e6d200597bb5d61ed56ccf9d70a52614956a70.tar.bz2
llvm-12e6d200597bb5d61ed56ccf9d70a52614956a70.tar.xz
add a method for comparing to see if a value has a specified name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Value.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index a61a1a0247..cf696fe44f 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -136,6 +136,13 @@ unsigned Value::getNameLen() const {
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 "";