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

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 1 09:45:55 PDT 2018


malcolm.parsons updated this revision to Diff 144742.
malcolm.parsons added a comment.

Add test


Repository:
  rC Clang

https://reviews.llvm.org/D45611

Files:
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  test/Coverage/html-multifile-diagnostics.c


Index: test/Coverage/html-multifile-diagnostics.c
===================================================================
--- test/Coverage/html-multifile-diagnostics.c
+++ test/Coverage/html-multifile-diagnostics.c
@@ -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
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.144742.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180501/3e80df3e/attachment.bin>


More information about the cfe-commits mailing list