Fix assertion in ObjectFileELF
authorPavel Labath <labath@google.com>
Wed, 17 Jan 2018 14:40:25 +0000 (14:40 +0000)
committerPavel Labath <labath@google.com>
Wed, 17 Jan 2018 14:40:25 +0000 (14:40 +0000)
In D40616 I (mistakenly) assumed that logging an llvm::Error would clear
it. This of course is only true if logging is actually enabled.

This fixes the assertion by manually clearing the error, but it raises
the point of whether we need a special error-clearing logging primitive.

llvm-svn: 322664

lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

index 36027dd..433a229 100644 (file)
@@ -3493,6 +3493,7 @@ size_t ObjectFileELF::ReadSectionData(Section *section,
   if (!Decompressor) {
     LLDB_LOG(log, "Unable to initialize decompressor for section {0}: {1}",
              section->GetName(), llvm::toString(Decompressor.takeError()));
+    consumeError(Decompressor.takeError());
     return result;
   }
   auto buffer_sp =
@@ -3502,6 +3503,7 @@ size_t ObjectFileELF::ReadSectionData(Section *section,
            size_t(buffer_sp->GetByteSize())})) {
     LLDB_LOG(log, "Decompression of section {0} failed: {1}",
              section->GetName(), llvm::toString(std::move(Error)));
+    consumeError(std::move(Error));
     return result;
   }
   section_data.SetData(buffer_sp);