[Lldb-commits] [lldb] [llvm] Add a createError variant without error code (NFC) (PR #93209)

Lang Hames via lldb-commits lldb-commits at lists.llvm.org
Mon May 27 17:18:54 PDT 2024


lhames wrote:

Late to the party here, but some context might be of interest:

`inconvertibleErrorCode` was meant to never be used, except with a documented explanation of why no error code could be supplied. The idea was to make conversion between `Error` and `std::error_code` illegal when no error code was supplied.

In practice (1) nobody has adhered to the documentation rule (me included), and (2) nobody seems to be converting errors back into std::error_codes in a dangerous way*. At this point I'd be fine getting rid of `inconvertibleErrorCode` entirely and replacing it with an "unknownErrorCode" that could be used as a default instead.

* There is some danger that people _have_ tried such invalid conversions and either caught the issue before submitting, or have never hit the dangerous path at runtime and don't realize it's there. If we switched to a safe "unknownErrorCode" we would lose some signal on the former (it'd be an error report rather than a crash), but would prevent the latter from happening in production.

https://github.com/llvm/llvm-project/pull/93209


More information about the lldb-commits mailing list