From: Alp Toker Date: Fri, 27 Jun 2014 04:48:32 +0000 (+0000) Subject: Propagate const-correctness into parseBitcodeFile() X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6ae844eea7fafcdce8cb313fb8fed6ad5be193b;p=platform%2Fupstream%2Fllvm.git Propagate const-correctness into parseBitcodeFile() llvm-svn: 211864 --- 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,