Michael137 wrote:

> Looking up global variables is not completely ideal (can be slow and look up 
> unrelated things). Would index_obj.GetValueAs**Signed**() == -1 work by any 
> chance?

Actually after some more investigating it turns out the test was just flawed. A 
default-constructed variant has a valid index (being the first element of the 
variant). The only case where the index is `variant_npos` is when the variant 
is "valueless", which [according to 
cppreference](https://en.cppreference.com/w/cpp/utility/variant/valueless_by_exception.html)
 only happens when an exception is thrown during assignment to the variant.

I adjusted the test to test that scenario, and the formatter seems to work.

https://github.com/llvm/llvm-project/pull/147283
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to