Skip to content

Commit f4650c9

Browse files
[memprof] Make HeapProfileRecords optional
memprof::AllMemProfData has become home to multiple types of memprof data -- heap profile and static data profile. When we write test cases for static data profile in YAML, we do not want to include empty heap profile. That would just add visual clutter. This patch makes HeapProfileRecords optional.
1 parent 2b24287 commit f4650c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/include/llvm/ProfileData/MemProfYAML.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ template <> struct MappingTraits<memprof::YamlDataAccessProfData> {
263263

264264
template <> struct MappingTraits<memprof::AllMemProfData> {
265265
static void mapping(IO &Io, memprof::AllMemProfData &Data) {
266-
Io.mapRequired("HeapProfileRecords", Data.HeapProfileRecords);
266+
if (!Io.outputting() || !Data.HeapProfileRecords.empty())
267+
Io.mapOptional("HeapProfileRecords", Data.HeapProfileRecords);
267268
// Map data access profiles if reading input, or if writing output &&
268269
// the struct is populated.
269270
if (!Io.outputting() || !Data.YamlifiedDataAccessProfiles.isEmpty())

0 commit comments

Comments
 (0)