[cfe-commits] [PATCH] [arm] clean up compiler warnings
Saleem Abdulrasool
compnerd at compnerd.org
Mon Dec 10 23:55:53 PST 2012
Cleanup compiler warnings on discarding type qualifiers in casts. Switch to C++ style casts.
http://llvm-reviews.chandlerc.com/D204
Files:
lib/Target/ARM/ARMCodeEmitter.cpp
lib/Target/ARM/ARMConstantPoolValue.cpp
Index: lib/Target/ARM/ARMCodeEmitter.cpp
===================================================================
--- lib/Target/ARM/ARMCodeEmitter.cpp
+++ lib/Target/ARM/ARMCodeEmitter.cpp
@@ -371,12 +371,16 @@
}
bool ARMCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
- assert((MF.getTarget().getRelocationModel() != Reloc::Default ||
- MF.getTarget().getRelocationModel() != Reloc::Static) &&
+ TargetMachine &Target = const_cast<TargetMachine&>(MF.getTarget());
+
+ assert((Target.getRelocationModel() != Reloc::Default ||
+ Target.getRelocationModel() != Reloc::Static) &&
"JIT relocation model must be set to static or default!");
- JTI = ((ARMBaseTargetMachine &)MF.getTarget()).getJITInfo();
- II = (const ARMBaseInstrInfo *)MF.getTarget().getInstrInfo();
- TD = MF.getTarget().getDataLayout();
+
+ JTI = static_cast<ARMJITInfo*>(Target.getJITInfo());
+ II = static_cast<const ARMBaseInstrInfo*>(Target.getInstrInfo());
+ TD = Target.getDataLayout();
+
Subtarget = &TM.getSubtarget<ARMSubtarget>();
MCPEs = &MF.getConstantPool()->getConstants();
MJTEs = 0;
Index: lib/Target/ARM/ARMConstantPoolValue.cpp
===================================================================
--- lib/Target/ARM/ARMConstantPoolValue.cpp
+++ lib/Target/ARM/ARMConstantPoolValue.cpp
@@ -209,7 +209,7 @@
S(strdup(s)) {}
ARMConstantPoolSymbol::~ARMConstantPoolSymbol() {
- free((void*)S);
+ free(const_cast<void*>(reinterpret_cast<const void *>(S)));
}
ARMConstantPoolSymbol *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D204.1.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121210/ff4fa7e9/attachment.bin>
More information about the cfe-commits
mailing list