From f6ae844eea7fafcdce8cb313fb8fed6ad5be193b Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Fri, 27 Jun 2014 04:48:32 +0000 Subject: [PATCH] Propagate const-correctness into parseBitcodeFile() llvm-svn: 211864 --- llvm/include/llvm/Bitcode/ReaderWriter.h | 2 +- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 5 +++-- llvm/lib/IRReader/IRReader.cpp | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/include/llvm/Bitcode/ReaderWriter.h b/llvm/include/llvm/Bitcode/ReaderWriter.h index 4c194a6..c44b084 100644 --- a/llvm/include/llvm/Bitcode/ReaderWriter.h +++ b/llvm/include/llvm/Bitcode/ReaderWriter.h @@ -52,7 +52,7 @@ namespace llvm { /// Read the specified bitcode file, returning the module. /// This method *never* takes ownership of Buffer. - ErrorOr parseBitcodeFile(MemoryBuffer *Buffer, + ErrorOr parseBitcodeFile(const MemoryBuffer *Buffer, LLVMContext &Context); /// WriteBitcodeToFile - Write the specified module to the specified diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 4bbecfd..d763397 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3406,9 +3406,10 @@ Module *llvm::getStreamedBitcodeModule(const std::string &name, return M; } -ErrorOr llvm::parseBitcodeFile(MemoryBuffer *Buffer, +ErrorOr llvm::parseBitcodeFile(const MemoryBuffer *Buffer, LLVMContext &Context) { - ErrorOr ModuleOrErr = getLazyBitcodeModule(Buffer, Context); + ErrorOr ModuleOrErr = + getLazyBitcodeModule(const_cast(Buffer), Context); if (!ModuleOrErr) return ModuleOrErr; Module *M = ModuleOrErr.get(); diff --git a/llvm/lib/IRReader/IRReader.cpp b/llvm/lib/IRReader/IRReader.cpp index 2bbe075..9d90324 100644 --- a/llvm/lib/IRReader/IRReader.cpp +++ b/llvm/lib/IRReader/IRReader.cpp @@ -68,8 +68,7 @@ Module *llvm::ParseIR(const MemoryBuffer *Buffer, SMDiagnostic &Err, TimePassesIsEnabled); if (isBitcode((const unsigned char *)Buffer->getBufferStart(), (const unsigned char *)Buffer->getBufferEnd())) { - ErrorOr ModuleOrErr = - parseBitcodeFile(const_cast(Buffer), Context); + ErrorOr ModuleOrErr = parseBitcodeFile(Buffer, Context); Module *M = nullptr; if (std::error_code EC = ModuleOrErr.getError()) Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error, -- 2.7.4