[Lldb-commits] [PATCH] D147669: PECOFF: enforce move semantics and consume errors properly

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 6 11:07:10 PDT 2023


bulbazord added inline comments.


================
Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:869-873
       LLDB_LOG(log,
                "ObjectFilePECOFF::AppendFromExportTable - failed to get export "
                "table entry name: {0}",
                llvm::fmt_consume(std::move(err)));
+      llvm::consumeError(std::move(err));
----------------
compnerd wrote:
> compnerd wrote:
> > compnerd wrote:
> > > bulbazord wrote:
> > > > If logging is enabled, we are moving from the same object twice, no?
> > > > 
> > > > I think we should rethink the LLDB_LOG macro when it comes to errors.... :/
> > > Yeah ... I was worried about that.
> > I should mention that at least on MSVC I _can_ get away with it:
> > 
> > ```
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found 
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> >  ObjectFilePECOFF::AppendFromExportTable - failed to get export table entry name: RVA 0x0 for export ordinal table not found
> > ```
> https://godbolt.org/z/nj4r7K8hb
> 
> UBSAN also seems to indicate it is permissible.
Moving from a standard library type leaves the original object in a "valid but unspecified" state. Do we make such guarantees about llvm::Errors? This is probably going to work "correctly" but I'm not sure what might go wrong.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147669/new/

https://reviews.llvm.org/D147669



More information about the lldb-commits mailing list