[Lldb-commits] [lldb] [lldb] Make conversions from llvm::Error explicit with Status::FromEr… (PR #107163)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 4 01:32:53 PDT 2024
https://github.com/labath commented:
I don't think this usage of rvalue references is very idiomatic. It saves an object copy (move), but:
- that should be very cheap anyway
- it increases the risk of improper handling and weird side-effects -- a function like `void use(Error E) {}` will always crash at the closing bracket (due to not checking the error), but `use(Error &&E){}` will never crash *inside* the function (because it doesn't own the error), and whether the program as a whole crashes depends on whether the caller does any other operation that would clear the error object.
So, I think it would be better to stick to value semantics. Other than that, this seems fine.
https://github.com/llvm/llvm-project/pull/107163
More information about the lldb-commits
mailing list