Skip to content

Commit 6b63f73

Browse files
fix use-of-uninitialized-memory error
1 parent 09eab64 commit 6b63f73

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

llvm/include/llvm/ProfileData/DataAccessProf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct DataAccessProfRecord {
115115
Locations.emplace_back(Loc.FileName, Loc.Line);
116116
}
117117
// Empty constructor is used in yaml conversion.
118-
DataAccessProfRecord() {}
118+
DataAccessProfRecord() : AccessCount(0) {}
119119
SymbolHandle SymHandle;
120120
uint64_t AccessCount;
121121
// The locations of data in the source code. Optional.

llvm/include/llvm/ProfileData/MemProfYAML.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ template <> struct MappingTraits<memprof::DataAccessProfRecord> {
248248
Rec.SymHandle = Hash;
249249
}
250250
}
251-
251+
Io.mapRequired("AccessCount", Rec.AccessCount);
252252
Io.mapOptional("Locations", Rec.Locations);
253253
}
254254
};

llvm/test/tools/llvm-profdata/memprof-yaml.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ HeapProfileRecords:
5151
DataAccessProfiles:
5252
SampledRecords:
5353
- Symbol: abcde
54+
AccessCount: 100
5455
Locations:
5556
- FileName: file2.h
5657
Line: 123
5758
- FileName: file3.cpp
5859
Line: 456
5960
- Hash: 101010
61+
AccessCount: 200
6062
Locations:
6163
- FileName: file.cpp
6264
Line: 233

0 commit comments

Comments
 (0)