@@ -272,24 +272,24 @@ void InstrProfWriter::addRecord(StringRef Name, uint64_t Hash,
272
272
273
273
void InstrProfWriter::addMemProfRecord (
274
274
const Function::GUID Id, const memprof::IndexedMemProfRecord &Record) {
275
- auto Result = MemProfRecordData.insert ({Id, Record});
275
+ auto [Iter, Inserted] = MemProfRecordData.insert ({Id, Record});
276
276
// If we inserted a new record then we are done.
277
- if (Result. second ) {
277
+ if (Inserted ) {
278
278
return ;
279
279
}
280
- memprof::IndexedMemProfRecord &Existing = Result. first ->second ;
280
+ memprof::IndexedMemProfRecord &Existing = Iter ->second ;
281
281
Existing.merge (Record);
282
282
}
283
283
284
284
bool InstrProfWriter::addMemProfFrame (const memprof::FrameId Id,
285
285
const memprof::Frame &Frame,
286
286
function_ref<void (Error)> Warn) {
287
- auto Result = MemProfFrameData.insert ({Id, Frame});
287
+ auto [Iter, Inserted] = MemProfFrameData.insert ({Id, Frame});
288
288
// If a mapping already exists for the current frame id and it does not
289
289
// match the new mapping provided then reset the existing contents and bail
290
290
// out. We don't support the merging of memprof data whose Frame -> Id
291
291
// mapping across profiles is inconsistent.
292
- if (!Result. second && Result. first ->second != Frame) {
292
+ if (!Inserted && Iter ->second != Frame) {
293
293
Warn (make_error<InstrProfError>(instrprof_error::malformed,
294
294
" frame to id mapping mismatch" ));
295
295
return false ;
@@ -388,10 +388,10 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
388
388
IPW.TemporalProfTraceStreamSize );
389
389
390
390
MemProfFrameData.reserve (IPW.MemProfFrameData .size ());
391
- for (auto &I : IPW.MemProfFrameData ) {
391
+ for (auto &[FrameId, Frame] : IPW.MemProfFrameData ) {
392
392
// If we weren't able to add the frame mappings then it doesn't make sense
393
393
// to try to merge the records from this profile.
394
- if (!addMemProfFrame (I. first , I. second , Warn))
394
+ if (!addMemProfFrame (FrameId, Frame , Warn))
395
395
return ;
396
396
}
397
397
@@ -402,8 +402,8 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
402
402
}
403
403
404
404
MemProfRecordData.reserve (IPW.MemProfRecordData .size ());
405
- for (auto &I : IPW.MemProfRecordData ) {
406
- addMemProfRecord (I. first , I. second );
405
+ for (auto &[GUID, Record] : IPW.MemProfRecordData ) {
406
+ addMemProfRecord (GUID, Record );
407
407
}
408
408
}
409
409
0 commit comments