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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to