From 13afd88a82c02d6be39053f43789e4ccb342e84e Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Wed, 10 Jul 2024 16:46:31 -0700 Subject: [PATCH] Address feedbacks from Alex --- llvm/include/llvm/CodeGenData/CodeGenData.h | 2 +- llvm/lib/CodeGenData/CodeGenDataReader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/CodeGenData/CodeGenData.h b/llvm/include/llvm/CodeGenData/CodeGenData.h index f46dc0c28cbc74..934ad20dd652db 100644 --- a/llvm/include/llvm/CodeGenData/CodeGenData.h +++ b/llvm/include/llvm/CodeGenData/CodeGenData.h @@ -81,7 +81,7 @@ class CGDataError : public ErrorInfo { /// contain a single CGDataError. static std::pair take(Error E) { auto Err = cgdata_error::success; - std::string Msg = ""; + std::string Msg; handleAllErrors(std::move(E), [&Err, &Msg](const CGDataError &IPE) { assert(Err == cgdata_error::success && "Multiple errors encountered"); Err = IPE.get(); diff --git a/llvm/lib/CodeGenData/CodeGenDataReader.cpp b/llvm/lib/CodeGenData/CodeGenDataReader.cpp index ea73cce4894acc..9ef182deda55eb 100644 --- a/llvm/lib/CodeGenData/CodeGenDataReader.cpp +++ b/llvm/lib/CodeGenData/CodeGenDataReader.cpp @@ -121,7 +121,7 @@ CodeGenDataReader::create(std::unique_ptr Buffer) { bool IndexedCodeGenDataReader::hasFormat(const MemoryBuffer &DataBuffer) { using namespace support; - if (DataBuffer.getBufferSize() < 8) + if (DataBuffer.getBufferSize() < sizeof(IndexedCGData::Magic)) return false; uint64_t Magic = endian::read(