Fix llvm-cov counts to be 64-bit integers to avoid overflows.

Line counts in llvm-cov are read in as 64-bit integers but were being truncated
to 32-bit in collectLineCounts(), which caused overflow for large counts.
This patch fixes all counts to be uint64_t.

Patch by Yuchen Wu!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson
2013-10-22 17:43:47 +00:00
parent 135fe6ac5f
commit 51ec77d880
2 changed files with 5 additions and 5 deletions

View File

@@ -219,7 +219,7 @@ void GCOVBlock::dump() {
/// collectLineCounts - Collect line counts. This must be used after
/// reading .gcno and .gcda files.
void GCOVLines::collectLineCounts(FileInfo &FI, StringRef Filename,
uint32_t Count) {
uint64_t Count) {
for (SmallVectorImpl<uint32_t>::iterator I = Lines.begin(),
E = Lines.end(); I != E; ++I)
FI.addLineCount(Filename, *I, Count);
@@ -236,7 +236,7 @@ void GCOVLines::dump() {
// FileInfo implementation.
/// addLineCount - Add line count for the given line number in a file.
void FileInfo::addLineCount(StringRef Filename, uint32_t Line, uint32_t Count) {
void FileInfo::addLineCount(StringRef Filename, uint32_t Line, uint64_t Count) {
if (LineInfo.find(Filename) == LineInfo.end()) {
OwningPtr<MemoryBuffer> Buff;
if (error_code ec = MemoryBuffer::getFileOrSTDIN(Filename, Buff)) {