Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check what parts of template are instantiated?

I have a huge template file and only few functions are used, and I want to isolate that part for test and comment the other half. How can i find what's the best way to do this ?

How can I do this on a Windows system and the template file is .hxx ?

like image 213
user496666 Avatar asked Nov 15 '22 06:11

user496666


1 Answers

I like Mohammad's answer. Oops... he removed it - but basically - use a tool like nm - I don't know a windows equivalent but there's sure to be one - to query the objects for instantations. While your templates may be in a .hxx, you can only meaningfully talk about the subset of methods instantiated by some body of client code. You may need to do this analysis with inlining disabled, to ensure the function bodies are actually instantiated in a tangible form in the object files.

In the less likely event that you might have instantiated stuff because some code handles cases that you know the data doesn't - and won't evolve to - use, then you may prefer automated run-time coverage analysis. Many compilers (e.g. GCC's g++ -ftest-coverage) and tools (e.g. purecov) provide this.

like image 93
Tony Delroy Avatar answered Dec 18 '22 10:12

Tony Delroy