-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Static analyzer HTML output has incorrect links to "note" diagnostics #64054
Comments
Now I see that path-sensitive diagnostic elements start at diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
index 0fe0c93dc016..f91a51cc5f8f 100644
--- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -592,11 +592,11 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,
P->getLocation().asLocation().getExpansionLineNumber();
int ColumnNumber =
P->getLocation().asLocation().getExpansionColumnNumber();
+ ++NumExtraPieces;
os << "<tr><td class=\"rowname\">Note:</td><td>"
<< "<a href=\"#Note" << NumExtraPieces << "\">line "
<< LineNumber << ", column " << ColumnNumber << "</a><br />"
<< P->getString() << "</td></tr>";
- ++NumExtraPieces;
}
}
|
@llvm/issue-subscribers-clang-static-analyzer |
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
For more instructions on how to submit a patch to LLVM, see our documentation. If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue. @llvm/issue-subscribers-good-first-issue |
@EugeneZelenko @nicolas17 I would like to fix this. Please assign this to me. |
IDs of the note list start from 1. Link generated for each note started with index 0 i.e #Note0, #Note1 and so on. As a result, first link ("#Note0") was invalid, subsequent links pointed at wrong note. Now, generated links to the notes start with index 1 i.e (#Note1, #Note2 and so on. Patch by Guruprasad Hegde (gruuprasad)! Fixes llvm#64054 Differential Revision: https://reviews.llvm.org/D156724
IDs of the note list start from 1. Link generated for each note started with index 0 i.e #Note0, #Note1 and so on. As a result, first link ("#Note0") was invalid, subsequent links pointed at wrong note. Now, generated links to the notes start with index 1 i.e (#Note1, #Note2 and so on. Patch by Guruprasad Hegde (gruuprasad)! Fixes llvm#64054 Differential Revision: https://reviews.llvm.org/D156724
When the clang static analyzer outputs HTML reports, there is a "Bug Summary" section at the top, which has in-page anchor links to the diagnostics in the source file below. When the checker generates "notes" with
BugReport.addNote
, this section has links to every note in the report.However, these links are off by one. The first link doesn't work, the second link points at the first note, the third link points at the second note, etc.
To reproduce:
The output HTML has links to
#EndPath
,#Note0
,#Note1
,#Note2
,#Note3
(generated byHTMLDiagnostics::FinalizeHTML
), but the notes themselves haveid="Note1"
,id="Note2"
,id="Note3"
,id="Note4"
(generated byRewriteFile
andHandlePiece
).It looks like
FinalizeHTML
generates the links in incremental order from 0, butRewriteFile
is iterating over the notes in reverse order and starts at n (not n-1).The text was updated successfully, but these errors were encountered: