diff options
author | Mingming Liu <mingmingl@google.com> | 2025-07-09 16:48:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-09 16:48:17 -0700 |
commit | 20daa73a0962efd22cee3bbf327ee35b22add39d (patch) | |
tree | 07e7ce94582c84a5cdd58dde9c46bdf6f1565779 /llvm/lib/ProfileData/SampleProfReader.cpp | |
parent | cd65f8bf17ecfc9896fd9913905f182ad7ce1446 (diff) | |
download | llvm-20daa73a0962efd22cee3bbf327ee35b22add39d.zip llvm-20daa73a0962efd22cee3bbf327ee35b22add39d.tar.gz llvm-20daa73a0962efd22cee3bbf327ee35b22add39d.tar.bz2 |
[NFC]Codestyle changes for SampleFDO library (#147840)
* Introduce an error code for illegal_line_offset in sampleprof_error
namespace, and use it for line offset parsing error.
* Add `const` for `LineLocation::serialize`.
* Use structured binding, make_first/second_range in loops.
I'm working on a [sample-profile format
change](https://github.com/llvm/llvm-project/compare/users/mingmingl-llvm/samplefdo-profile-format)
to extend SampleFDO profile with vtable profiles. And this change splits
the non-functional changes.
Diffstat (limited to 'llvm/lib/ProfileData/SampleProfReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/SampleProfReader.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp index 6466618..cf78740 100644 --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -609,7 +609,7 @@ SampleProfileReaderBinary::readProfile(FunctionSamples &FProfile) { return EC; if (!isOffsetLegal(*LineOffset)) { - return std::error_code(); + return sampleprof_error::illegal_line_offset; } auto Discriminator = readNumber<uint64_t>(); @@ -1236,7 +1236,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readCSNameTableSec() { return EC; if (!isOffsetLegal(*LineOffset)) - return std::error_code(); + return sampleprof_error::illegal_line_offset; auto Discriminator = readNumber<uint64_t>(); if (std::error_code EC = Discriminator.getError()) |