aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-10 15:34:35 +0000
committerChris Lattner <sabre@nondot.org>2007-08-10 15:34:35 +0000
commit71996e73d8050d2b8805b14a48ab635155b11a12 (patch)
tree50f63865fa6df6bfca0c5ce40e6365d8dba17441 /lib/VMCore
parent57a6f30125ad4f83de0147379835e4386872f479 (diff)
downloadexternal_llvm-71996e73d8050d2b8805b14a48ab635155b11a12.zip
external_llvm-71996e73d8050d2b8805b14a48ab635155b11a12.tar.gz
external_llvm-71996e73d8050d2b8805b14a48ab635155b11a12.tar.bz2
add Value::getNameStart/getNameLen() accessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Value.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp
index 790ae17..2178ce4 100644
--- a/lib/VMCore/Value.cpp
+++ b/lib/VMCore/Value.cpp
@@ -117,6 +117,21 @@ static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
return false;
}
+/// getNameStart - Return a pointer to a null terminated string for this name.
+/// Note that names can have null characters within the string as well as at
+/// their end. This always returns a non-null pointer.
+const char *Value::getNameStart() const {
+ if (Name == 0) return "";
+ return Name->getKeyData();
+}
+
+/// getNameLen - Return the length of the string, correctly handling nul
+/// characters embedded into them.
+unsigned Value::getNameLen() const {
+ return Name->getKeyLength();
+}
+
+
std::string Value::getNameStr() const {
if (Name == 0) return "";
return std::string(Name->getKeyData(),