[llvm] [ProfileData] Remove an unnecessary cast (NFC) (PR #148341)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 23:55:27 PDT 2025


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

getBufferStart() already returns const char *.


>From dbbe933b41338f57b4b60dee1391b69d70ff82df Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 11 Jul 2025 11:35:27 -0700
Subject: [PATCH] [ProfileData] Remove an unnecessary cast (NFC)

getBufferStart() already returns const char *.
---
 llvm/lib/ProfileData/SampleProfReader.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index cf7874041f3bf..d147222fe2ce6 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -1839,7 +1839,7 @@ std::error_code SampleProfileReaderGCC::readImpl() {
 }
 
 bool SampleProfileReaderGCC::hasFormat(const MemoryBuffer &Buffer) {
-  StringRef Magic(reinterpret_cast<const char *>(Buffer.getBufferStart()));
+  StringRef Magic(Buffer.getBufferStart());
   return Magic == "adcg*704";
 }
 



More information about the llvm-commits mailing list