[lldb] Fix missing comsumeError() with LLDB_LOG in ObjectFileCOFF/PECOFF (#70793)
All `llvm::Error`s must be checked/consumed before destruction. Previously, the errors in this patch were only consumed when logging was enabled. Using `LLDB_LOG_ERROR` instead of `LLDB_LOG` fixes that, because it calls `llvm::consumeError()` explicitly when logging is disabled.
This commit is contained in:
@@ -791,11 +791,10 @@ void ObjectFilePECOFF::AppendFromCOFFSymbolTable(
|
||||
for (const auto &sym_ref : m_binary->symbols()) {
|
||||
const auto coff_sym_ref = m_binary->getCOFFSymbol(sym_ref);
|
||||
auto name_or_error = sym_ref.getName();
|
||||
if (auto err = name_or_error.takeError()) {
|
||||
LLDB_LOG(log,
|
||||
"ObjectFilePECOFF::AppendFromCOFFSymbolTable - failed to get "
|
||||
"symbol table entry name: {0}",
|
||||
llvm::fmt_consume(std::move(err)));
|
||||
if (!name_or_error) {
|
||||
LLDB_LOG_ERROR(log, name_or_error.takeError(),
|
||||
"ObjectFilePECOFF::AppendFromCOFFSymbolTable - failed to "
|
||||
"get symbol table entry name: {0}");
|
||||
continue;
|
||||
}
|
||||
const llvm::StringRef sym_name = *name_or_error;
|
||||
|
||||
Reference in New Issue
Block a user