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 | a1d850ee1cdc2576f34cc38ac3018eb850ab33fe (patch) | |
tree | 4cf7a141ef19d08d718f5fd135e9330dde9fc999 /llvm/lib/VMCore/Value.cpp | |
parent | 438e35c4d15121ae64e1e9cd45f0c6bcc18e7828 (diff) | |
download | bcm5719-llvm-a1d850ee1cdc2576f34cc38ac3018eb850ab33fe.tar.gz bcm5719-llvm-a1d850ee1cdc2576f34cc38ac3018eb850ab33fe.zip |
add a method for comparing to see if a value has a specified name.
llvm-svn: 50465
Diffstat (limited to 'llvm/lib/VMCore/Value.cpp')
-rw-r--r-- | llvm/lib/VMCore/Value.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index a61a1a02472..cf696fe44fe 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/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 ""; |