aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/InstrProfWriter.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-06-07 15:06:04 -0700
committerGitHub <noreply@github.com>2024-06-07 15:06:04 -0700
commitbfa937a48767a3dd10c5847034ce0b341da00a93 (patch)
tree3ffee8fd339ce83dd8da70fa962bdc85f02d9d6a /llvm/lib/ProfileData/InstrProfWriter.cpp
parent7520d0c9ae4564654ebf843d0295492246948242 (diff)
downloadllvm-bfa937a48767a3dd10c5847034ce0b341da00a93.zip
llvm-bfa937a48767a3dd10c5847034ce0b341da00a93.tar.gz
llvm-bfa937a48767a3dd10c5847034ce0b341da00a93.tar.bz2
[ProfileData] Add const to a few places (NFC) (#94803)
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfWriter.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index a73f72a..7d7c980 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -55,7 +55,7 @@ public:
ProfOStream(raw_string_ostream &STR)
: IsFDOStream(false), OS(STR), LE(STR, llvm::endianness::little) {}
- uint64_t tell() { return OS.tell(); }
+ [[nodiscard]] uint64_t tell() const { return OS.tell(); }
void write(uint64_t V) { LE.write<uint64_t>(V); }
void write32(uint32_t V) { LE.write<uint32_t>(V); }
void writeByte(uint8_t V) { LE.write<uint8_t>(V); }
@@ -894,7 +894,7 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
BinaryIds.erase(std::unique(BinaryIds.begin(), BinaryIds.end()),
BinaryIds.end());
- for (auto BI : BinaryIds) {
+ for (const auto &BI : BinaryIds) {
// Increment by binary id length data type size.
BinaryIdsSectionSize += sizeof(uint64_t);
// Increment by binary id data length, aligned to 8 bytes.
@@ -903,7 +903,7 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
// Write binary ids section size.
OS.write(BinaryIdsSectionSize);
- for (auto BI : BinaryIds) {
+ for (const auto &BI : BinaryIds) {
uint64_t BILen = BI.size();
// Write binary id length.
OS.write(BILen);