I'm a bit worried that this source range can get veeeeeeeeery long because the object on which the member is taken may be relatively complicated to compute.
Why don't we just say field 'f' - i.e., something like Assuming field 'f' is null - either always, or when the sub-expression turns out to be too long to display?
...and then de-duplicate this code snippet into a function(?)
Is this a common thing to happen? Why don't other overrides of VisitTrueTest have such checks?
- Rebased and addressed comments.
It is rare of course. I do not know why this is happening but it is a straightforward way to bypass such errors.
If I remove this Loc validation:
UnaryOperator 0x55e6814f8770 'int' prefix '!' cannot overflow `-ImplicitCastExpr 0x55e6814f8758 'unsigned long' <IntegralToBoolean> `-ImplicitCastExpr 0x55e6814f8740 'unsigned long' <LValueToRValue> `-MemberExpr 0x55e6814f8710 'unsigned long' lvalue .__state_ 0x55e6814cc710 `-DeclRefExpr 0x55e6814f86f0 'std::once_flag':'struct std::once_flag_s' lvalue ParmVar 0x55e6814ecbe0 'o' 'std::once_flag &'
UnaryOperator 0x556bdac7cf80 'int' prefix '!' cannot overflow `-ImplicitCastExpr 0x556bdac7cf68 'int' <IntegralToBoolean> `-ImplicitCastExpr 0x556bdac7cf50 'int' <LValueToRValue> `-MemberExpr 0x556bdac7cf20 'int' lvalue ._M_once 0x556bdac39b90 `-DeclRefExpr 0x556bdac64440 'std::once_flag':'struct std::once_flag_s' lvalue ParmVar 0x556bdac63cc0 'o' 'std::once_flag &'
Looks great, thanks!
Hmm, body farms, okay. I guess nobody really knows what's going on in body farms, so let's keep it as is until we see more crashes. I'd expect other overrides of VisitTrueTest to grow such checks in the future.