[llvm-commits] [llvm] r101779 - in /llvm/trunk/lib: Archive/Archive.cpp Archive/ArchiveReader.cpp VMCore/TypeSymbolTable.cpp
Dan Gohman
gohman at apple.com
Mon Apr 19 08:42:05 PDT 2010
Author: djg
Date: Mon Apr 19 10:42:05 2010
New Revision: 101779
URL: http://llvm.org/viewvc/llvm-project?rev=101779&view=rev
Log:
Fix -Wcast-qual warnings.
Modified:
llvm/trunk/lib/Archive/Archive.cpp
llvm/trunk/lib/Archive/ArchiveReader.cpp
llvm/trunk/lib/VMCore/TypeSymbolTable.cpp
Modified: llvm/trunk/lib/Archive/Archive.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/Archive.cpp?rev=101779&r1=101778&r2=101779&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/Archive.cpp (original)
+++ llvm/trunk/lib/Archive/Archive.cpp Mon Apr 19 10:42:05 2010
@@ -241,7 +241,7 @@
// Get the module.
std::auto_ptr<MemoryBuffer> Buffer(
MemoryBuffer::getNewMemBuffer(Length, ModuleID.c_str()));
- memcpy((char*)Buffer->getBufferStart(), BufPtr, Length);
+ memcpy(const_cast<char *>(Buffer->getBufferStart()), BufPtr, Length);
Module *M = ParseBitcodeFile(Buffer.get(), Context, ErrMsg);
if (!M)
Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=101779&r1=101778&r2=101779&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/ArchiveReader.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveReader.cpp Mon Apr 19 10:42:05 2010
@@ -349,7 +349,8 @@
"(" + I->getPath().str() + ")";
MemoryBuffer *Buffer =
MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str());
- memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize());
+ memcpy(const_cast<char *>(Buffer->getBufferStart()),
+ I->getData(), I->getSize());
Module *M = ParseBitcodeFile(Buffer, Context, ErrMessage);
delete Buffer;
@@ -489,7 +490,8 @@
mbr->getPath().str() + ")";
MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(mbr->getSize(),
FullMemberName.c_str());
- memcpy((char*)Buffer->getBufferStart(), mbr->getData(), mbr->getSize());
+ memcpy(const_cast<char *>(Buffer->getBufferStart()),
+ mbr->getData(), mbr->getSize());
Module *m = getLazyBitcodeModule(Buffer, Context, ErrMsg);
if (!m)
@@ -617,7 +619,8 @@
MemoryBuffer *Buffer =
MemoryBuffer::getNewMemBuffer(I->getSize(), FullMemberName.c_str());
- memcpy((char*)Buffer->getBufferStart(), I->getData(), I->getSize());
+ memcpy(const_cast<char *>(Buffer->getBufferStart()),
+ I->getData(), I->getSize());
Module *M = ParseBitcodeFile(Buffer, Context);
delete Buffer;
if (!M)
Modified: llvm/trunk/lib/VMCore/TypeSymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/TypeSymbolTable.cpp?rev=101779&r1=101778&r2=101779&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/TypeSymbolTable.cpp (original)
+++ llvm/trunk/lib/VMCore/TypeSymbolTable.cpp Mon Apr 19 10:42:05 2010
@@ -126,13 +126,15 @@
// faster to remove them all in one pass.
//
for (iterator I = begin(), E = end(); I != E; ++I) {
- if (I->second == (Type*)OldType) { // FIXME when Types aren't const.
+ // FIXME when Types aren't const.
+ if (I->second == const_cast<DerivedType *>(OldType)) {
#if DEBUG_ABSTYPE
dbgs() << "Removing type " << OldType->getDescription() << "\n";
#endif
OldType->removeAbstractTypeUser(this);
- I->second = (Type*)NewType; // TODO FIXME when types aren't const
+ // TODO FIXME when types aren't const
+ I->second = const_cast<Type *>(NewType);
if (NewType->isAbstract()) {
#if DEBUG_ABSTYPE
dbgs() << "Added type " << NewType->getDescription() << "\n";
More information about the llvm-commits
mailing list