added support to bin-search unused functions

* Previously, I misinterpreted isReferenced flags
for templates. Fixed most of those. There are
still some cases where I couldn't figure out
how to resolve. For example,

template<typename T> struct S;
template<typename T> void foo(S<T>);
template<> void foo(S<char>);
template void foo(S<char>);

Seems there is no easy way to retrive the source
location for the template instantiation at
line 4. Internally, this instantiation
is represented as a canonical declaration
of the explicit specialization at line 3,
and thus its source location gets lost.
Note that in this case we couldn't get the instantiation
point as we did for explicit instantiations.

* added support to bin-search unused functions.