From: Alp Toker Date: Fri, 27 Jun 2014 09:19:14 +0000 (+0000) Subject: IRReader: don't mark MemoryBuffers const X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de4c009be49c133fb484eba1cf2c7d3755b8147b;p=platform%2Fupstream%2Fllvm.git IRReader: don't mark MemoryBuffers const llvm-svn: 211883 --- diff --git a/llvm/include/llvm/Bitcode/ReaderWriter.h b/llvm/include/llvm/Bitcode/ReaderWriter.h index c44b084..4c194a6 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(const MemoryBuffer *Buffer, + ErrorOr parseBitcodeFile(MemoryBuffer *Buffer, LLVMContext &Context); /// WriteBitcodeToFile - Write the specified module to the specified diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h index 20022cf..82c3752 100644 --- a/llvm/include/llvm/IRReader/IRReader.h +++ b/llvm/include/llvm/IRReader/IRReader.h @@ -41,8 +41,7 @@ Module *getLazyIRFileModule(const std::string &Filename, SMDiagnostic &Err, /// If the given MemoryBuffer holds a bitcode image, return a Module /// for it. Otherwise, attempt to parse it as LLVM Assembly and return /// a Module for it. This function *never* takes ownership of Buffer. -Module *ParseIR(const MemoryBuffer *Buffer, SMDiagnostic &Err, - LLVMContext &Context); +Module *ParseIR(MemoryBuffer *Buffer, SMDiagnostic &Err, LLVMContext &Context); /// If the given file holds a bitcode image, return a Module for it. /// Otherwise, attempt to parse it as LLVM Assembly and return a Module diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index d763397..4bbecfd 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3406,10 +3406,9 @@ Module *llvm::getStreamedBitcodeModule(const std::string &name, return M; } -ErrorOr llvm::parseBitcodeFile(const MemoryBuffer *Buffer, +ErrorOr llvm::parseBitcodeFile(MemoryBuffer *Buffer, LLVMContext &Context) { - ErrorOr ModuleOrErr = - getLazyBitcodeModule(const_cast(Buffer), Context); + ErrorOr ModuleOrErr = getLazyBitcodeModule(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 9d90324..719319d 100644 --- a/llvm/lib/IRReader/IRReader.cpp +++ b/llvm/lib/IRReader/IRReader.cpp @@ -62,7 +62,7 @@ Module *llvm::getLazyIRFileModule(const std::string &Filename, SMDiagnostic &Err return getLazyIRModule(File.release(), Err, Context); } -Module *llvm::ParseIR(const MemoryBuffer *Buffer, SMDiagnostic &Err, +Module *llvm::ParseIR(MemoryBuffer *Buffer, SMDiagnostic &Err, LLVMContext &Context) { NamedRegionTimer T(TimeIRParsingName, TimeIRParsingGroupName, TimePassesIsEnabled);