Check for unused local variables
This is implemented by simply reference counting local variables, and producing a warning when the number of references is zero.
In addition to adding support for this, we also clean up some unused local variables that were discovered with this new check.