assert tc.global
if not tc.no_dead_method_removal then optimize_dead_methods
end
+
+ # This method will create log files storing analysis information
+ fun dump_global_analysis_information(directory_name: String) do
+ dump_reachable_methods(directory_name, tc.global_callgraph)
+ dump_unreachable_methods(directory_name, tc.global_callgraph)
+ end
end
redef class IRoutine
redef class Program
# This attribute is the ReachableMethodAnalysis results
readable writable var _rma: nullable ReachableMethodAnalysis = null
+
+ # This method will create a file and output all reachable method names in it
+ fun dump_reachable_methods(directory_name: String, algo: String) do
+ var f = new OFStream.open("{directory_name}/{module.name}.reachable_methods.{algo}.log")
+ with_each_methods !action(m) do
+ if rma.is_method_reachable(m) then
+ f.write("{m.full_name}\n")
+ end
+ end
+ f.close
+ end
+
+ # This method will create a file and output all unreachable method names in it
+ fun dump_unreachable_methods(directory_name: String, algo: String) do
+ var f = new OFStream.open("{directory_name}/{module.name}.unreachable_methods.{algo}.log")
+ with_each_methods !action(m) do
+ if not rma.is_method_reachable(m) then
+ f.write("{m.full_name}\n")
+ end
+ end
+ f.close
+ end
end
# Subclasses of this class would represent an analysis that produces