[PATCH] D45611: [analyzer] Fix filename in cross-file HTML report

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 13 01:41:34 PDT 2018


malcolm.parsons created this revision.
malcolm.parsons added reviewers: george.karpenkov, dcoughlin, vlad.tsyrklevich.
Herald added subscribers: cfe-commits, a.sidorin, szepet, xazax.hun.

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.


Repository:
  rC Clang

https://reviews.llvm.org/D45611

Files:
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp


Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -321,7 +321,9 @@
     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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45611.142353.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180413/0825d405/attachment.bin>


More information about the cfe-commits mailing list