BurtonQin/lockbud

why use the "instance" rather than implementing a block visitor to build the callgraph?

ffanyq opened this issue · 2 comments

why use the "instance" rather than implementing a block visitor to build the callgraph?

The implementation uses Instance::resolve to get the callee instance.

if let Some(callee) = Instance::resolve(self.tcx, self.param_env, def_id, substs)

An instance is more suitable than a function's def_id in the analysis in that
i) the instance here is fully instantiated, providing concrete type info and handy APIs.
and ii) eliminating dead functions.

Thanks for your answer!