r341619 - [analyzer] Executed lines: store file IDs, not hashes.

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 6 17:43:37 PDT 2018


Author: george.karpenkov
Date: Thu Sep  6 17:43:37 2018
New Revision: 341619

URL: http://llvm.org/viewvc/llvm-project?rev=341619&view=rev
Log:
[analyzer] Executed lines: store file IDs, not hashes.

Raw FileIDs are needed for the PlistDiagnostics to produce stable filenames.

Differential Revision: https://reviews.llvm.org/D51668

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

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=341619&r1=341618&r2=341619&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Thu Sep  6 17:43:37 2018
@@ -759,7 +759,7 @@ public:
 };
 
 /// 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,

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=341619&r1=341618&r2=341619&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Thu Sep  6 17:43:37 2018
@@ -1893,7 +1893,7 @@ static void updateExecutedLinesWithDiagn
     FileID FID = Loc.getFileID();
     unsigned LineNo = Loc.getLineNumber();
     assert(FID.isValid());
-    ExecutedLines[FID.getHashValue()].insert(LineNo);
+    ExecutedLines[FID].insert(LineNo);
   }
 }
 
@@ -3030,7 +3030,7 @@ static void populateExecutedLinesWithFun
 
   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 @@ static void populateExecutedLinesWithStm
   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

Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=341619&r1=341618&r2=341619&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Thu Sep  6 17:43:37 2018
@@ -346,7 +346,7 @@ static void serializeExecutedLines(
     if (I != ExecutedLines.begin())
       os << ", ";
 
-    os << "\"" << I->first << "\": {";
+    os << "\"" << I->first.getHashValue() << "\": {";
     for (unsigned LineNo : I->second) {
       if (LineNo != *(I->second.begin()))
         os << ", ";




More information about the cfe-commits mailing list