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 | 1bf717f4958c01eab4e2bfdc4bf64105846bd7d9 (patch) | |
tree | 5d6ca20313ef2e50aa43dd5a894e762f49186eb0 /lib/VMCore/Value.cpp | |
parent | 0bf186f378b9623ec80d51580cfc3fa284ce9424 (diff) | |
download | external_llvm-1bf717f4958c01eab4e2bfdc4bf64105846bd7d9.zip external_llvm-1bf717f4958c01eab4e2bfdc4bf64105846bd7d9.tar.gz external_llvm-1bf717f4958c01eab4e2bfdc4bf64105846bd7d9.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/Value.cpp')
-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 ""; |