@@ -34,6 +34,7 @@ using ::llvm::memprof::CallStackId;
3434using ::llvm::memprof::CallStackMap;
3535using ::llvm::memprof::Frame;
3636using ::llvm::memprof::FrameId;
37+ using ::llvm::memprof::hashCallStack;
3738using ::llvm::memprof::IndexedAllocationInfo;
3839using ::llvm::memprof::IndexedMemProfRecord;
3940using ::llvm::memprof::MemInfoBlock;
@@ -46,8 +47,11 @@ using ::llvm::memprof::RawMemProfReader;
4647using ::llvm::memprof::SegmentEntry;
4748using ::llvm::object::SectionedAddress;
4849using ::llvm::symbolize::SymbolizableModule;
50+ using ::testing::ElementsAre;
51+ using ::testing::Pair;
4952using ::testing::Return;
5053using ::testing::SizeIs;
54+ using ::testing::UnorderedElementsAre;
5155
5256class MockSymbolizer : public SymbolizableModule {
5357public:
@@ -788,35 +792,31 @@ TEST(MemProf, YAMLParser) {
788792 llvm::SmallVector<FrameId> CS4 = {F7.hash (), F8.hash ()};
789793
790794 // Verify the entire contents of MemProfData.Frames.
791- EXPECT_THAT (
792- MemProfData.Frames ,
793- ::testing::UnorderedElementsAre (
794- ::testing::Pair (F1.hash(), F1), ::testing::Pair(F2.hash(), F2),
795- ::testing::Pair(F3.hash(), F3), ::testing::Pair(F4.hash(), F4),
796- ::testing::Pair(F5.hash(), F5), ::testing::Pair(F6.hash(), F6),
797- ::testing::Pair(F7.hash(), F7), ::testing::Pair(F8.hash(), F8)));
795+ EXPECT_THAT (MemProfData.Frames ,
796+ UnorderedElementsAre (Pair (F1.hash (), F1), Pair (F2.hash (), F2),
797+ Pair (F3.hash (), F3), Pair (F4.hash (), F4),
798+ Pair (F5.hash (), F5), Pair (F6.hash (), F6),
799+ Pair (F7.hash (), F7), Pair (F8.hash (), F8)));
798800
799801 // Verify the entire contents of MemProfData.Frames.
800802 EXPECT_THAT (MemProfData.CallStacks ,
801- ::testing::UnorderedElementsAre (
802- ::testing::Pair (llvm::memprof::hashCallStack(CS1), CS1),
803- ::testing::Pair(llvm::memprof::hashCallStack(CS2), CS2),
804- ::testing::Pair(llvm::memprof::hashCallStack(CS3), CS3),
805- ::testing::Pair(llvm::memprof::hashCallStack(CS4), CS4)));
803+ UnorderedElementsAre (Pair (hashCallStack (CS1), CS1),
804+ Pair (hashCallStack (CS2), CS2),
805+ Pair (hashCallStack (CS3), CS3),
806+ Pair (hashCallStack (CS4), CS4)));
806807
807808 // Verify the entire contents of MemProfData.Records.
808809 ASSERT_THAT (MemProfData.Records , SizeIs (1 ));
809810 const auto &[GUID, Record] = *MemProfData.Records .begin ();
810811 EXPECT_EQ (GUID, 0xdeadbeef12345678ULL );
811812 ASSERT_THAT (Record.AllocSites , SizeIs (2 ));
812- EXPECT_EQ (Record.AllocSites[0 ].CSId, llvm::memprof:: hashCallStack(CS1));
813+ EXPECT_EQ (Record.AllocSites [0 ].CSId , hashCallStack (CS1));
813814 EXPECT_EQ (Record.AllocSites [0 ].Info .getAllocCount (), 777U );
814815 EXPECT_EQ (Record.AllocSites [0 ].Info .getTotalSize (), 888U );
815- EXPECT_EQ (Record.AllocSites[1 ].CSId, llvm::memprof:: hashCallStack(CS2));
816+ EXPECT_EQ (Record.AllocSites [1 ].CSId , hashCallStack (CS2));
816817 EXPECT_EQ (Record.AllocSites [1 ].Info .getAllocCount (), 666U );
817818 EXPECT_EQ (Record.AllocSites [1 ].Info .getTotalSize (), 555U );
818819 EXPECT_THAT (Record.CallSiteIds ,
819- ::testing::ElementsAre (llvm::memprof::hashCallStack(CS3),
820- llvm::memprof::hashCallStack(CS4)));
820+ ElementsAre (hashCallStack (CS3), hashCallStack (CS4)));
821821}
822822} // namespace
0 commit comments