From dfd4bbfdfba518f194f4795dfc963dfa456d0246 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 19 Apr 2010 15:42:05 +0000 Subject: Fix -Wcast-qual warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101779 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Archive/Archive.cpp | 2 +- lib/Archive/ArchiveReader.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/Archive') diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp index f4f8a4349e..4f100f7b11 100644 --- a/lib/Archive/Archive.cpp +++ b/lib/Archive/Archive.cpp @@ -241,7 +241,7 @@ llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length, // Get the module. std::auto_ptr Buffer( MemoryBuffer::getNewMemBuffer(Length, ModuleID.c_str())); - memcpy((char*)Buffer->getBufferStart(), BufPtr, Length); + memcpy(const_cast(Buffer->getBufferStart()), BufPtr, Length); Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg); if (!M) diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index 3ef15d25d6..cbd0bb3975 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -349,7 +349,8 @@ Archive::getAllModules(std::vector& Modules, "(" + I->getPath().str() + ")"; MemoryBuffer *Buffer = MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str()); - memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize()); + memcpy(const_cast(Buffer->getBufferStart()), + I->getData(), I->getSize()); Module *M = ParseBitcodeFile(Buffer, Context, ErrMessage); delete Buffer; @@ -489,7 +490,8 @@ Archive::findModuleDefiningSymbol(const std::string& symbol, mbr->getPath().str() + ")"; MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(mbr->getSize(), FullMemberName.c_str()); - memcpy((char*)Buffer->getBufferStart(), mbr->getData(), mbr->getSize()); + memcpy(const_cast(Buffer->getBufferStart()), + mbr->getData(), mbr->getSize()); Module *m = getLazyBitcodeModule(Buffer, Context, ErrMsg); if (!m) @@ -617,7 +619,8 @@ bool Archive::isBitcodeArchive() { MemoryBuffer *Buffer = MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str()); - memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize()); + memcpy(const_cast(Buffer->getBufferStart()), + I->getData(), I->getSize()); Module *M = ParseBitcodeFile(Buffer, Context); delete Buffer; if (!M) -- cgit v1.2.3-18-g5258