Skip to content

Commit 8b24028

Browse files
[memprof] Use structured binding (NFC) (#89315)
1 parent 78eb2c2 commit 8b24028

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

llvm/lib/ProfileData/InstrProfWriter.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,24 +272,24 @@ void InstrProfWriter::addRecord(StringRef Name, uint64_t Hash,
272272

273273
void InstrProfWriter::addMemProfRecord(
274274
const Function::GUID Id, const memprof::IndexedMemProfRecord &Record) {
275-
auto Result = MemProfRecordData.insert({Id, Record});
275+
auto [Iter, Inserted] = MemProfRecordData.insert({Id, Record});
276276
// If we inserted a new record then we are done.
277-
if (Result.second) {
277+
if (Inserted) {
278278
return;
279279
}
280-
memprof::IndexedMemProfRecord &Existing = Result.first->second;
280+
memprof::IndexedMemProfRecord &Existing = Iter->second;
281281
Existing.merge(Record);
282282
}
283283

284284
bool InstrProfWriter::addMemProfFrame(const memprof::FrameId Id,
285285
const memprof::Frame &Frame,
286286
function_ref<void(Error)> Warn) {
287-
auto Result = MemProfFrameData.insert({Id, Frame});
287+
auto [Iter, Inserted] = MemProfFrameData.insert({Id, Frame});
288288
// If a mapping already exists for the current frame id and it does not
289289
// match the new mapping provided then reset the existing contents and bail
290290
// out. We don't support the merging of memprof data whose Frame -> Id
291291
// mapping across profiles is inconsistent.
292-
if (!Result.second && Result.first->second != Frame) {
292+
if (!Inserted && Iter->second != Frame) {
293293
Warn(make_error<InstrProfError>(instrprof_error::malformed,
294294
"frame to id mapping mismatch"));
295295
return false;
@@ -388,10 +388,10 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
388388
IPW.TemporalProfTraceStreamSize);
389389

390390
MemProfFrameData.reserve(IPW.MemProfFrameData.size());
391-
for (auto &I : IPW.MemProfFrameData) {
391+
for (auto &[FrameId, Frame] : IPW.MemProfFrameData) {
392392
// If we weren't able to add the frame mappings then it doesn't make sense
393393
// to try to merge the records from this profile.
394-
if (!addMemProfFrame(I.first, I.second, Warn))
394+
if (!addMemProfFrame(FrameId, Frame, Warn))
395395
return;
396396
}
397397

@@ -402,8 +402,8 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
402402
}
403403

404404
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);
407407
}
408408
}
409409

0 commit comments

Comments
 (0)