@@ -471,7 +471,7 @@ TEST_F(InstrProfTest, test_memprof_v0) {
471
471
};
472
472
473
473
const memprof::MemProfRecord WantRecord (IndexedMR, IdToFrameCallback);
474
- ASSERT_FALSE (LastUnmappedFrameId. has_value () )
474
+ ASSERT_EQ (LastUnmappedFrameId, std::nullopt )
475
475
<< " could not map frame id: " << *LastUnmappedFrameId;
476
476
EXPECT_THAT (WantRecord, EqualsRecord (Record));
477
477
}
@@ -607,22 +607,20 @@ TEST_F(InstrProfTest, test_memprof_merge) {
607
607
ASSERT_THAT_ERROR (RecordOr.takeError (), Succeeded ());
608
608
const memprof::MemProfRecord &Record = RecordOr.get ();
609
609
610
- memprof::FrameId LastUnmappedFrameId = 0 ;
611
- bool HasFrameMappingError = false ;
610
+ std::optional<memprof::FrameId> LastUnmappedFrameId;
612
611
613
612
auto IdToFrameCallback = [&](const memprof::FrameId Id) {
614
613
auto Iter = IdToFrameMap.find (Id);
615
614
if (Iter == IdToFrameMap.end ()) {
616
615
LastUnmappedFrameId = Id;
617
- HasFrameMappingError = true ;
618
616
return memprof::Frame (0 , 0 , 0 , false );
619
617
}
620
618
return Iter->second ;
621
619
};
622
620
623
621
const memprof::MemProfRecord WantRecord (IndexedMR, IdToFrameCallback);
624
- ASSERT_FALSE (HasFrameMappingError )
625
- << " could not map frame id: " << LastUnmappedFrameId;
622
+ ASSERT_EQ (LastUnmappedFrameId, std::nullopt )
623
+ << " could not map frame id: " << * LastUnmappedFrameId;
626
624
EXPECT_THAT (WantRecord, EqualsRecord (Record));
627
625
}
628
626
0 commit comments