[PATCH] D51668: [analyzer] Coverage information: store FileIDs, not hashes

George Karpenkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 6 17:45:56 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL341619: [analyzer] Executed lines: store file IDs, not hashes. (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51668?vs=163957&id=164337#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51668

Files:
  cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp


Index: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
===================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -759,7 +759,7 @@
 };
 
 /// File IDs mapped to sets of line numbers.
-using FilesToLineNumsMap = std::map<unsigned, std::set<unsigned>>;
+using FilesToLineNumsMap = std::map<FileID, std::set<unsigned>>;
 
 /// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive
 ///  diagnostic.  It represents an ordered-collection of PathDiagnosticPieces,
Index: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1893,7 +1893,7 @@
     FileID FID = Loc.getFileID();
     unsigned LineNo = Loc.getLineNumber();
     assert(FID.isValid());
-    ExecutedLines[FID.getHashValue()].insert(LineNo);
+    ExecutedLines[FID].insert(LineNo);
   }
 }
 
@@ -3030,7 +3030,7 @@
 
   FileID FID = SM.getFileID(SM.getExpansionLoc(Start));
   for (unsigned Line = StartLine; Line <= EndLine; Line++)
-    ExecutedLines->operator[](FID.getHashValue()).insert(Line);
+    ExecutedLines->operator[](FID).insert(Line);
 }
 
 static void populateExecutedLinesWithStmt(
@@ -3042,7 +3042,7 @@
   SourceLocation ExpansionLoc = SM.getExpansionLoc(Loc);
   FileID FID = SM.getFileID(ExpansionLoc);
   unsigned LineNo = SM.getExpansionLineNumber(ExpansionLoc);
-  ExecutedLines->operator[](FID.getHashValue()).insert(LineNo);
+  ExecutedLines->operator[](FID).insert(LineNo);
 }
 
 /// \return all executed lines including function signatures on the path
Index: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -346,7 +346,7 @@
     if (I != ExecutedLines.begin())
       os << ", ";
 
-    os << "\"" << I->first << "\": {";
+    os << "\"" << I->first.getHashValue() << "\": {";
     for (unsigned LineNo : I->second) {
       if (LineNo != *(I->second.begin()))
         os << ", ";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51668.164337.patch
Type: text/x-patch
Size: 2344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/71be9141/attachment.bin>


More information about the llvm-commits mailing list