[llvm] [Profile] Add a more descriptive message to the bad_header error (PR #211281)

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 19:33:44 PDT 2026


================
@@ -650,7 +659,25 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
 
   auto *Start = reinterpret_cast<const char *>(&Header);
   if (Start + ValueDataOffset > DataBuffer->getBufferEnd())
-    return error(instrprof_error::bad_header);
+    return error(
+        instrprof_error::header_size_mismatch,
+        ("Profile file size (" + Twine(DataBuffer->getBufferSize()) +
----------------
hubert-reinterpretcast wrote:

Same comment re: message style.

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


More information about the llvm-commits mailing list