Some clients rely on getName{Start,End} not returning 0, even if the length is
authorDaniel Dunbar <daniel@zuster.org>
Sun, 26 Jul 2009 01:04:10 +0000 (01:04 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 26 Jul 2009 01:04:10 +0000 (01:04 +0000)
0.
 - I could have swore the prev change went through a make check cycle...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77106 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Value.h

index bee70b2147a64aee0f6803bba933cdb8d88d8535..72669cf24979c1abef0a99bed1c4408615d53617 100644 (file)
@@ -114,9 +114,15 @@ public:
   /// 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 *getNameStart() const { return getName().begin(); }
+  const char *getNameStart() const { 
+    if (!Name) return "";
+    return getName().begin(); 
+  }
   /// getNameEnd - Return a pointer to the end of the name.
-  const char *getNameEnd() const { return getName().end(); }
+  const char *getNameEnd() const { 
+    if (!Name) return "";
+    return getName().end(); 
+  }
   
   /// getNameLen - Return the length of the string, correctly handling nul
   /// characters embedded into them.