-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to collapse function with template as a single function in report #164
Comments
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
1. GCC's function alias attribute. There reporting the shortest name is
suitable.
2. However, use of templates (especially nested templates) probably will
cause nasty and long function names, even if the shortest one is picked. If
the function name has a pattern indicating the existence of use of
template, could all templates just be replaced with "<...>" string?
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
<#164 (comment)>,
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:
* In that case, you would get two leaders with the same “base_template<…>” name – but on different file/line locations.
That would confuse the lcov internals – which expect that the same name means that this is the same function. I’m not sure how hard it would be to fix that.
* A hacky workaround for that would be to create the “base_template<…>” alias and then punt/go back to use the original name if there was already a match, or to turn the second one into “base_template<…>2”.
That hack may go wrong (incorrect attribution) if different compilation units use different template specializations thus create different leader names for the “same” instantiation.
Again: not sure how hard it is to fix that.
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. |
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.The text was updated successfully, but these errors were encountered: