labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

I think this makes the code hard to read. A much better approach would be to 
use `Expected<T>` + factory function pattern. So you would have something like:

  Expected<unique_ptr<LLVMCDisassembler>> LLVMCDisassembler::Create(...) {
    do_first_thing_that_can_fail(...);
    if (first_thing_failed)
      return make_string_error("First thing failed");
    do_second_thing_that_can_fail();
    ...
    return make_unique<LLVMCDisassembler>(...); // can't fail
  }

I think this is much more readable than the lambda approach, and it also allows 
you to get rid of the IsValid() function, as we only construct valid objects.


https://reviews.llvm.org/D41584



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to