forked from OSchip/llvm-project
Make sure getName().data() is always null terminated.
llvm-svn: 77149
This commit is contained in:
parent
ca414c7cae
commit
7cc8f7e86d
|
@ -152,7 +152,10 @@ static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
|
|||
}
|
||||
|
||||
StringRef Value::getName() const {
|
||||
if (!Name) return StringRef();
|
||||
// Make sure the empty string is still a C string. For historical reasons,
|
||||
// some clients want to call .data() on the result and expect it to be null
|
||||
// terminated.
|
||||
if (!Name) return StringRef("", 0);
|
||||
return Name->getKey();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue