This patch fixes an issue with -Wunreachable-code diagnostic that happens with the following code sample:
struct s { void *p; }; void fn(struct s *s) { if (1 || !s->p) return; fn(s); }
Currently, clang will emit two warnings (at fn(s) and at !s->p). As well as that, the fixits for the first warning (for fn(s)) have an incorrect source range: it suggests to wrap !s->p in parentheses when it should suggest to wrap 1 instead.
The attached patch ensures that the fixits for the fn(s) warning suggest to wrap the correct expression (1). It also avoids the second warning that was previously shown for !s->p because that warning is caused by the same expression (1).
Thanks for taking a look.