|
18 | 18 |
|
19 | 19 | namespace { |
20 | 20 | using namespace llvm; |
| 21 | +using namespace llvm::memprof; |
| 22 | +using testing::FieldsAre; |
| 23 | +using testing::Pair; |
| 24 | +using testing::SizeIs; |
21 | 25 |
|
22 | 26 | TEST(MemProf, ExtractDirectCallsFromIR) { |
23 | 27 | // The following IR is generated from: |
@@ -76,28 +80,25 @@ declare !dbg !19 void @_Z2f3v() |
76 | 80 | std::unique_ptr<Module> M = parseAssemblyString(IR, Err, Ctx); |
77 | 81 | ASSERT_TRUE(M); |
78 | 82 |
|
79 | | - auto Calls = memprof::extractCallsFromIR(*M); |
| 83 | + auto Calls = extractCallsFromIR(*M); |
80 | 84 |
|
81 | 85 | // Expect exactly one caller. |
82 | | - ASSERT_THAT(Calls, testing::SizeIs(1)); |
| 86 | + ASSERT_THAT(Calls, SizeIs(1)); |
83 | 87 |
|
84 | 88 | auto It = Calls.begin(); |
85 | 89 | ASSERT_NE(It, Calls.end()); |
86 | 90 |
|
87 | 91 | const auto &[CallerGUID, CallSites] = *It; |
88 | | - EXPECT_EQ(CallerGUID, memprof::IndexedMemProfRecord::getGUID("_Z3foov")); |
89 | | - ASSERT_THAT(CallSites, testing::SizeIs(3)); |
| 92 | + EXPECT_EQ(CallerGUID, IndexedMemProfRecord::getGUID("_Z3foov")); |
| 93 | + ASSERT_THAT(CallSites, SizeIs(3)); |
90 | 94 |
|
91 | 95 | // Verify that call sites show up in the ascending order of their source |
92 | 96 | // locations. |
93 | 97 | EXPECT_THAT(CallSites[0], |
94 | | - testing::Pair(testing::FieldsAre(1U, 3U), |
95 | | - memprof::IndexedMemProfRecord::getGUID("_Z2f1v"))); |
| 98 | + Pair(FieldsAre(1U, 3U), IndexedMemProfRecord::getGUID("_Z2f1v"))); |
96 | 99 | EXPECT_THAT(CallSites[1], |
97 | | - testing::Pair(testing::FieldsAre(2U, 3U), |
98 | | - memprof::IndexedMemProfRecord::getGUID("_Z2f2v"))); |
| 100 | + Pair(FieldsAre(2U, 3U), IndexedMemProfRecord::getGUID("_Z2f2v"))); |
99 | 101 | EXPECT_THAT(CallSites[2], |
100 | | - testing::Pair(testing::FieldsAre(2U, 9U), |
101 | | - memprof::IndexedMemProfRecord::getGUID("_Z2f3v"))); |
| 102 | + Pair(FieldsAre(2U, 9U), IndexedMemProfRecord::getGUID("_Z2f3v"))); |
102 | 103 | } |
103 | 104 | } // namespace |
0 commit comments