gccrs: Add dead code scan on HIR
authorThomas Young <wenzhang5800@gmail.com>
Tue, 23 Aug 2022 15:34:35 +0000 (16:34 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 13 Dec 2022 13:00:06 +0000 (14:00 +0100)
commit520b52b24e73d2ec48fd6f492266df42c218bdf2
treeae9e6163fb2b700a41e8f1d07c3b95837350b354
parentca246e573fb3f53fba5794f72b9245382eb46180
gccrs: Add dead code scan on HIR

In order to find dead code we use a depth first search and keep liveness
variables, after type resolution. In this case, if a function is unused
and it calls another function the 2nd function is now unused since the
caller is not used etc. The algorithm is a depth first search.

gcc/rust/
* checks/lints/rust-lint-marklive-base.h: New.
* checks/lints/rust-lint-marklive.cc: New.
* checks/lints/rust-lint-marklive.h: New.
* checks/lints/rust-lint-scan-deadcode.h: New.
gcc/rust/checks/lints/rust-lint-marklive-base.h [new file with mode: 0644]
gcc/rust/checks/lints/rust-lint-marklive.cc [new file with mode: 0644]
gcc/rust/checks/lints/rust-lint-marklive.h [new file with mode: 0644]
gcc/rust/checks/lints/rust-lint-scan-deadcode.h [new file with mode: 0644]