[Lldb-commits] [PATCH] D149987: ObjectFile: introduce a COFF object file plugin

Saleem Abdulrasool via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri May 5 14:05:44 PDT 2023


compnerd added inline comments.


================
Comment at: lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp:103-104
+
+  return new ObjectFileCOFF(module_sp, data_sp, data_offset, file, file_offset,
+                            length);
+}
----------------
bulbazord wrote:
> Reading the implementation of the constructor, it looks like the constructor can fail to initialize correctly (specifically `m_object` may not be correctly populated). What are callers supposed to do in the way of validation here? Maybe there is further validation we can do in this function so that the constructor is only invoked if we're absolutely sure it will work?
There isn't much you can do IMO.  The `new` can fail just as well - at which point, what do we do?  The constructor should only really fail if the return type from libLLVMObject has suddenly changed into an invalid type.  That cast really cannot fail in a way that we can recover from.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149987



More information about the lldb-commits mailing list