aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-19 15:42:05 +0000
committerDan Gohman <gohman@apple.com>2010-04-19 15:42:05 +0000
commitdfd4bbfdfba518f194f4795dfc963dfa456d0246 (patch)
treeac3d9e425ec917c296234a5a9a2a2a2550969291 /lib
parent5af8f421b6412e52530608097e39d2602195629f (diff)
Fix -Wcast-qual warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Archive/Archive.cpp2
-rw-r--r--lib/Archive/ArchiveReader.cpp9
-rw-r--r--lib/VMCore/TypeSymbolTable.cpp6
3 files changed, 11 insertions, 6 deletions
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<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)
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<Module*>& Modules,
"(" + 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 @@ 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<char *>(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<char *>(Buffer->getBufferStart()),
+ I->getData(), I->getSize());
Module *M = ParseBitcodeFile(Buffer, Context);
delete Buffer;
if (!M)
diff --git a/lib/VMCore/TypeSymbolTable.cpp b/lib/VMCore/TypeSymbolTable.cpp
index b4daf0f631..d68a44bd67 100644
--- a/lib/VMCore/TypeSymbolTable.cpp
+++ b/lib/VMCore/TypeSymbolTable.cpp
@@ -126,13 +126,15 @@ void TypeSymbolTable::refineAbstractType(const DerivedType *OldType,
// 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";