[PATCH] D64991: [analyzer][WIP] Implement a primitive reaching definitions analysis

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 7 09:29:33 PDT 2019


Szelethus added a comment.

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
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64991/new/

https://reviews.llvm.org/D64991





More information about the cfe-commits mailing list