[PATCH] D49202: Restructure the minidump loading path and add early & explicit consistency checks

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 16 09:04:01 PDT 2018


labath added a comment.

I don't agree with the two-stage initialization of the MinidumpParser class being introduced here. We deliberately introduced the `Create` static function to avoid this. If this `Initialize` function in checking invariants which are assumed to be hold by other parser methods, then it should be done by the `Create` function. Ideally this would be done before even constructing the parser object, but if this is impractical for some reason then you can make the `Initialize` function private and call it directly from `Create`. This way a user will never be able to see an malformed parser object. To make sure you propagate the error, you can change the return type of `Create` to `llvm::Expected<MinidumpParser` (the only reason we did not do this back then was that there was no precedent for using `Expected` in LLDB, but this is no longer the case).


Repository:
  rL LLVM

https://reviews.llvm.org/D49202





More information about the llvm-commits mailing list