This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Show full analyzer invocation for reproducibility in HTML reports
ClosedPublic

Authored by george.karpenkov on Jan 18 2018, 3:57 PM.

Details

Reviewers
NoQ
dcoughlin
Summary

Analyzing problems which appear in scan-build results can be very difficult, as after the launch no exact invocation is stored, and it's super-hard to launch the debugger.
With this patch, the exact analyzer invocation appears in the header hidden under the spoiler CSS tag, and can be copied to debug/check reproducibility/etc.

rdar://35980230

Diff Detail

Event Timeline

george.karpenkov edited the summary of this revision. (Show Details)Jan 18 2018, 5:50 PM

Hello George,

Maybe it is better to put this information into header? The most important warning information is shown in the header.

lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
480

Can we use SmallString instead?

Maybe it is better to put this information into header? The most important warning information is shown in the header.

The problem is on large projects the invocation is huge, taking easily one third of the screen.
We might even move into another direction, hiding it further with the HTML comment.
The information is not really relevant to the end user, and analyzer developers would be able to grab it from the source.

lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
480

I guess; previous construction at line 425 uses std::string

NoQ added a comment.Jan 19 2018, 10:59 AM

I guess at the top < at the bottom < at the top under a CSS spoiler (collapsed by default).

Now with spoiler-tag approach

george.karpenkov edited the summary of this revision. (Show Details)Jan 19 2018, 3:04 PM
NoQ accepted this revision.Jan 23 2018, 10:33 AM

Yay!

This revision is now accepted and ready to land.Jan 23 2018, 10:33 AM

Committed in git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323245 91177308-0d34-0410-b5e6-96231b3b80d8

Remember that html reports are not just used by analyzer developers but also by end users. For end users, the clang invocation is an implementation detail of the analyzer and not part of its user model. We shouldn't display this to users.

You should either hide this feature behind a flag (so users won't see it but analyzer developers can turn it on) or put this information into an HTML comment (so users won't see it but analyzer developers can look at the HTML source to determine the invocation).

@dcoughlin I think having it beside the flag would defeat the whole purpose, as you would like to try to reproduce the run by getting a report from unsuspecting user.
So you think even the spoiler tag is unacceptable? (preview below)

I think that hiding in comments would hurt discoverability, and given the usefulness of the feature I think it justifies having an extra irrelevant line for the user.
(and also for the power user the compiler arguments might even be useful).
It's also nicer to copy-n-paste without having to hunt for the line inside the source view.
But of course if you insist I could hide it in the comment.