Skip to content

Commit a3fdd17

Browse files
author
George Karpenkov
committedSep 7, 2018
[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 llvm-svn: 341619
1 parent 55e3d1e commit a3fdd17

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
 

‎clang/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ class PathDiagnosticNotePiece: public PathDiagnosticSpotPiece {
759759
};
760760

761761
/// File IDs mapped to sets of line numbers.
762-
using FilesToLineNumsMap = std::map<unsigned, std::set<unsigned>>;
762+
using FilesToLineNumsMap = std::map<FileID, std::set<unsigned>>;
763763

764764
/// PathDiagnostic - PathDiagnostic objects represent a single path-sensitive
765765
/// diagnostic. It represents an ordered-collection of PathDiagnosticPieces,

‎clang/lib/StaticAnalyzer/Core/BugReporter.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@ static void updateExecutedLinesWithDiagnosticPieces(
18931893
FileID FID = Loc.getFileID();
18941894
unsigned LineNo = Loc.getLineNumber();
18951895
assert(FID.isValid());
1896-
ExecutedLines[FID.getHashValue()].insert(LineNo);
1896+
ExecutedLines[FID].insert(LineNo);
18971897
}
18981898
}
18991899

@@ -3030,7 +3030,7 @@ static void populateExecutedLinesWithFunctionSignature(
30303030

30313031
FileID FID = SM.getFileID(SM.getExpansionLoc(Start));
30323032
for (unsigned Line = StartLine; Line <= EndLine; Line++)
3033-
ExecutedLines->operator[](FID.getHashValue()).insert(Line);
3033+
ExecutedLines->operator[](FID).insert(Line);
30343034
}
30353035

30363036
static void populateExecutedLinesWithStmt(
@@ -3042,7 +3042,7 @@ static void populateExecutedLinesWithStmt(
30423042
SourceLocation ExpansionLoc = SM.getExpansionLoc(Loc);
30433043
FileID FID = SM.getFileID(ExpansionLoc);
30443044
unsigned LineNo = SM.getExpansionLineNumber(ExpansionLoc);
3045-
ExecutedLines->operator[](FID.getHashValue()).insert(LineNo);
3045+
ExecutedLines->operator[](FID).insert(LineNo);
30463046
}
30473047

30483048
/// \return all executed lines including function signatures on the path

‎clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static void serializeExecutedLines(
346346
if (I != ExecutedLines.begin())
347347
os << ", ";
348348

349-
os << "\"" << I->first << "\": {";
349+
os << "\"" << I->first.getHashValue() << "\": {";
350350
for (unsigned LineNo : I->second) {
351351
if (LineNo != *(I->second.begin()))
352352
os << ", ";

0 commit comments

Comments
 (0)
Please sign in to comment.