mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Make sure getName().data() is always null terminated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f0443c1eb4
commit
4fa4990bdc
@ -152,7 +152,10 @@ static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StringRef Value::getName() const {
|
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();
|
return Name->getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user