r331361 - [analyzer] Fix filename in cross-file HTML report
Malcolm Parsons via cfe-commits
cfe-commits at lists.llvm.org
Wed May 2 07:26:12 PDT 2018
Author: malcolm.parsons
Date: Wed May 2 07:26:12 2018
New Revision: 331361
URL: http://llvm.org/viewvc/llvm-project?rev=331361&view=rev
Log:
[analyzer] Fix filename in cross-file HTML report
Summary:
The filename is currently taken from the start of the path, while the
line and column are taken from the end of the path.
This didn't matter until cross-file path reporting was added.
Reviewers: george.karpenkov, dcoughlin, vlad.tsyrklevich
Reviewed By: george.karpenkov, vlad.tsyrklevich
Subscribers: xazax.hun, szepet, a.sidorin, cfe-commits
Differential Revision: https://reviews.llvm.org/D45611
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/test/Coverage/html-multifile-diagnostics.c
Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=331361&r1=331360&r2=331361&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Wed May 2 07:26:12 2018
@@ -321,7 +321,9 @@ std::string HTMLDiagnostics::GenerateHTM
return {};
// Add CSS, header, and footer.
- const FileEntry* Entry = SMgr.getFileEntryForID(FileIDs[0]);
+ FileID FID =
+ path.back()->getLocation().asLocation().getExpansionLoc().getFileID();
+ const FileEntry* Entry = SMgr.getFileEntryForID(FID);
FinalizeHTML(D, R, SMgr, path, FileIDs[0], Entry, declName);
std::string file;
Modified: cfe/trunk/test/Coverage/html-multifile-diagnostics.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/html-multifile-diagnostics.c?rev=331361&r1=331360&r2=331361&view=diff
==============================================================================
--- cfe/trunk/test/Coverage/html-multifile-diagnostics.c (original)
+++ cfe/trunk/test/Coverage/html-multifile-diagnostics.c Wed May 2 07:26:12 2018
@@ -4,6 +4,8 @@
// REQUIRES: staticanalyzer
+// CHECK: <!-- FILENAME html-multifile-diagnostics.h -->
+
// CHECK: <h3>Annotated Source Code</h3>
// Make sure it's generated as multi-file HTML output
More information about the cfe-commits
mailing list