[llvm] [memprof] Use front instead of begin in a unit test (NFC) (PR #119501)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 21:03:13 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

"front" allows us to drop a dereference.


---
Full diff: https://github.com/llvm/llvm-project/pull/119501.diff


1 Files Affected:

- (modified) llvm/unittests/ProfileData/MemProfTest.cpp (+1-1) 


``````````diff
diff --git a/llvm/unittests/ProfileData/MemProfTest.cpp b/llvm/unittests/ProfileData/MemProfTest.cpp
index 093b3a26b5f872..e121bae8b4481b 100644
--- a/llvm/unittests/ProfileData/MemProfTest.cpp
+++ b/llvm/unittests/ProfileData/MemProfTest.cpp
@@ -747,7 +747,7 @@ TEST(MemProf, YAMLParser) {
 
   // Verify the entire contents of MemProfData.Records.
   ASSERT_THAT(MemProfData.Records, SizeIs(1));
-  const auto &[GUID, Record] = *MemProfData.Records.begin();
+  const auto &[GUID, Record] = MemProfData.Records.front();
   EXPECT_EQ(GUID, 0xdeadbeef12345678ULL);
   ASSERT_THAT(Record.AllocSites, SizeIs(2));
   EXPECT_EQ(Record.AllocSites[0].CSId, hashCallStack(CS1));

``````````

</details>


https://github.com/llvm/llvm-project/pull/119501


More information about the llvm-commits mailing list