[PATCH] D64991: [analyzer][WIP] Implement a primitive reaching definitions analysis
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 9 17:27:12 PDT 2019
NoQ added a comment.
In D64991#1662185 <https://reviews.llvm.org/D64991#1662185>, @Szelethus wrote:
> Hmm, we could make a redundant assignments checker: if a variable has multiple reaching definitions, but those all assign the same value, emit a warning. We could even use fixits with that.
>
> void t(int a) {
> if (coin())
> a = 2; // note: reaching def
> else
> a = 2; // note: reaching def
> use(a); // warn: a is always 2 here
> }
Sounds like a useful //compiler warning// to me.
Also what specific fixit do you have in mind and why do you think it'll be easily obtainable from the results of the reaching definition analysis?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64991/new/
https://reviews.llvm.org/D64991
More information about the cfe-commits
mailing list