[Lldb-commits] [PATCH] D58792: Add "operator bool" to SB APIs

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 1 05:40:57 PST 2019

labath added a comment.

In D58792#1414191 <https://reviews.llvm.org/D58792#1414191>, @shafik wrote:

> It stood out to me that some of the conversions were not `const` and I can see that `IsValid` is not consistently `const` across the API but after talking to @jingham it is unfortunately something we can't change.

Yes, that is unfortunate. I can think of three things that we could do differently though:

1. add a `const` version of `IsValid` where it is missing, and have and always-const `operator bool` which uses that
2. give up on constness and just have a non-const `operator bool` everywhere
3. add a const `operator bool` everywhere, and have `IsValid` (const or non-const) call into that

Each option has different tradeoffs, and it's not really clear to me which one is better. I am happy to implement whichever you think is best.



More information about the lldb-commits mailing list