mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Return ErrorOr from SymbolRef::getName.
This function can really fail since the string table offset can be out of bounds. Using ErrorOr makes sure the error is checked. Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241297 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -37,10 +37,10 @@ bool SectionRef::containsSymbol(SymbolRef S) const {
|
||||
|
||||
std::error_code ObjectFile::printSymbolName(raw_ostream &OS,
|
||||
DataRefImpl Symb) const {
|
||||
StringRef Name;
|
||||
if (std::error_code EC = getSymbolName(Symb, Name))
|
||||
ErrorOr<StringRef> Name = getSymbolName(Symb);
|
||||
if (std::error_code EC = Name.getError())
|
||||
return EC;
|
||||
OS << Name;
|
||||
OS << *Name;
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user