mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +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 {
|
||||
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…
x
Reference in New Issue
Block a user