diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-30 03:55:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-30 03:55:40 +0000 |
commit | 12e6d200597bb5d61ed56ccf9d70a52614956a70 (patch) | |
tree | 5d6ca20313ef2e50aa43dd5a894e762f49186eb0 /lib/VMCore | |
parent | ea8650cddfb4ec7a532409ea918173e050cb40e8 (diff) | |
download | external_llvm-12e6d200597bb5d61ed56ccf9d70a52614956a70.zip external_llvm-12e6d200597bb5d61ed56ccf9d70a52614956a70.tar.gz external_llvm-12e6d200597bb5d61ed56ccf9d70a52614956a70.tar.bz2 |
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/VMCore')
-rw-r--r-- | lib/VMCore/Value.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index a61a1a0..cf696fe 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 ""; |