Convert getSymbolSection to return an ErrorOr.
This function can actually fail since the symbol contains an index to the section and that can be invalid. llvm-svn: 244375
This commit is contained in:
@@ -98,8 +98,10 @@ void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) {
|
||||
|
||||
void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect,
|
||||
LLVMSymbolIteratorRef Sym) {
|
||||
if (std::error_code ec = (*unwrap(Sym))->getSection(*unwrap(Sect)))
|
||||
ErrorOr<section_iterator> SecOrErr = (*unwrap(Sym))->getSection();
|
||||
if (std::error_code ec = SecOrErr.getError())
|
||||
report_fatal_error(ec.message());
|
||||
*unwrap(Sect) = *SecOrErr;
|
||||
}
|
||||
|
||||
// ObjectFile Symbol iterators
|
||||
|
||||
Reference in New Issue
Block a user