[llvm] [memprof] Modernize DataAccessProfRecord (NFC) (PR #155702)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 14:26:34 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/155702

It's a bit safer to keep the initialization attached to the member
variable.


>From 7077ebf52dda1f1704f48e3d669d4e8e71053bd5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 27 Aug 2025 14:10:06 -0700
Subject: [PATCH] [memprof] Modernize DataAccessProfRecord (NFC)

It's a bit safer to keep the initialization attached to the member
variable.
---
 llvm/include/llvm/ProfileData/DataAccessProf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/include/llvm/ProfileData/DataAccessProf.h b/llvm/include/llvm/ProfileData/DataAccessProf.h
index f410096d83f5e..07230f23f3385 100644
--- a/llvm/include/llvm/ProfileData/DataAccessProf.h
+++ b/llvm/include/llvm/ProfileData/DataAccessProf.h
@@ -116,9 +116,9 @@ struct DataAccessProfRecord {
       Locations.emplace_back(Loc.FileName, Loc.Line);
   }
   // Empty constructor is used in yaml conversion.
-  DataAccessProfRecord() : AccessCount(0) {}
+  DataAccessProfRecord() = default;
   SymbolHandle SymHandle;
-  uint64_t AccessCount;
+  uint64_t AccessCount = 0;
   // The locations of data in the source code. Optional.
   SmallVector<SourceLocation> Locations;
 };



More information about the llvm-commits mailing list