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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

getBufferStart() already returns const char *.


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


1 Files Affected:

- (modified) llvm/lib/ProfileData/SampleProfReader.cpp (+1-1) 


``````````diff
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";
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list