diff options
author | Kazu Hirata <kazu@google.com> | 2025-09-28 10:27:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-28 10:27:29 -0700 |
commit | 9a5671efac31d91e3479c6ae6a0af6196100beb3 (patch) | |
tree | 898a9cffad48dc7f07edc26d178df8f8532a01bf /llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | |
parent | 372f78643e7154f8b3f28a01aebdc1aab87168fb (diff) | |
download | llvm-9a5671efac31d91e3479c6ae6a0af6196100beb3.zip llvm-9a5671efac31d91e3479c6ae6a0af6196100beb3.tar.gz llvm-9a5671efac31d91e3479c6ae6a0af6196100beb3.tar.bz2 |
[Support] Deprecate one form of support::endian::byte_swap (NFC) (#161045)
This is a follow-up to #156140 and #160979, which deprecated one form of
write and read, respectively.
We have two forms of byte_swap:
template <typename value_type>
[[nodiscard]] inline value_type byte_swap(value_type value, endianness
endian)
template <typename value_type, endianness endian>
[[nodiscard]] inline value_type byte_swap(value_type value)
The difference is that endian is a function parameter in the former
but a template parameter in the latter.
This patch streamlines the code by migrating the use of the latter to
the former while deprecating the latter because the latter is just
forwarded to the former.
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp index fc2577e..075ad8d 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp @@ -949,9 +949,9 @@ loadTestingFormat(StringRef Data, StringRef CompilationDir) { if (Data.size() < sizeof(uint64_t)) return make_error<CoverageMapError>(coveragemap_error::malformed, "the size of data is too small"); - auto TestingVersion = - support::endian::byte_swap<uint64_t, llvm::endianness::little>( - *reinterpret_cast<const uint64_t *>(Data.data())); + auto TestingVersion = support::endian::byte_swap<uint64_t>( + *reinterpret_cast<const uint64_t *>(Data.data()), + llvm::endianness::little); Data = Data.substr(sizeof(uint64_t)); // Read the ProfileNames data. @@ -1274,9 +1274,9 @@ BinaryCoverageReader::create( std::vector<std::unique_ptr<BinaryCoverageReader>> Readers; if (ObjectBuffer.getBuffer().size() > sizeof(TestingFormatMagic)) { - uint64_t Magic = - support::endian::byte_swap<uint64_t, llvm::endianness::little>( - *reinterpret_cast<const uint64_t *>(ObjectBuffer.getBufferStart())); + uint64_t Magic = support::endian::byte_swap<uint64_t>( + *reinterpret_cast<const uint64_t *>(ObjectBuffer.getBufferStart()), + llvm::endianness::little); if (Magic == TestingFormatMagic) { // This is a special format used for testing. auto ReaderOrErr = |