Open Matti-Lehtonen opened 1 year ago
I actually implemented that 😊 I called them ‘function aliases” – enabled by adding “--filter function” to your genhtml command line. It decides that two names are aliases if they have the same file and line location. The ‘leader’ is the shortest name (fewest characters); tie break uses alphabetic sort. I recommend you use “—cpp-demangle” for C++ code, to get more meaningful names (and better sorting).
You can find that feature as well as several others at https://github.com/henry2cox/lcov/tree/diffcov_initial (Pull request in progress – but not yet merged to lcov master.)
Hope this helps
Henry
Thanx!
Hi,
just my two cents ..
There are at least two "methods" to create function aliases, like
Matti L
On Thu, 8 Sept 2022 at 18:01, Henry Cox @.***> wrote:
I actually implemented that 😊 I called them ‘function aliases” – enabled by adding “--filter function” to your genhtml command line. It decides that two names are aliases if they have the same file and line location. The ‘leader’ is the shortest name (fewest characters); tie break uses alphabetic sort. I recommend you use “—cpp-demangle” for C++ code, to get more meaningful names (and better sorting).
You can find that feature as well as several others at https://github.com/henry2cox/lcov/tree/diffcov_initial (Pull request in progress – but not yet merged to lcov master.)
Hope this helps
Henry
— Reply to this email directly, view it on GitHub https://github.com/linux-test-project/lcov/issues/164#issuecomment-1240840179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQRA3ICDAH4IKAEQQREUT6LV5H5UNANCNFSM6AAAAAAQH2QFSQ . You are receiving this because you authored the thread.Message ID: @.***>
That seems like a good idea.
The simple scheme won’t work quite right when there is template specialization:
Yet another issue is that this feature would need to be tested quite thoroughly – to make sure that there is no mis-attributed or dropped code. Internally, we use the tool with some moderately large projects, and it would be very, very hard to manually review to make sure nothing of importance changed. I’m also not sure how many of the special scenarios happen in our code – so I need tests which explicitly trigger those cases…and then hope that there are no other scenarios that I didn’t think of. ☹
An additional complication is that the featrue needs to work for systemverilog. Offhand, I’m not sure what the implications are. Again – the easiest hack would be to just turn off this transform unless we are sure that this is C++ source code.
Unless you object strongly, I’m going to shelve this enhancement request for the moment. I’ll put a “todo” comment in the source – and may get back to it one d If you feel like trolling through the code to implement this yourself…I certainly would not say “no” 😊
Henry
@henry2cox any update for this? Is the “--filter function” feature can be merged to master?
The basic 'function alias' feature described above was merged to master many months ago, and was released in lcov 2.0 back in May.
The feature requested here (more careful handling of template naming and template aliases) is more complicated and has not been done (at least, not by me).
Depending on what you are trying to do, the existing implementation may or may not be sufficient. If not: please try to explain what you need; it is possible that your requirement is different than @Matti-Lehtonen, and interesting to others as well.
You might also want to take a look at the --show-proportion
flag - which is also related to function coverage (but not to aliasing).
Add some option to report functions with template as single function in generated (html) reports
So instead of having a coverage report with three (3) functions of
sum
, actually report with singlesum
function would be preferred.