[cfe-commits] [PATCH] [arm] clean up compiler warnings
NAKAMURA Takumi
geek4civic at gmail.com
Tue Dec 11 01:58:28 PST 2012
Should it be for llvm-commits?
2012/12/11 Saleem Abdulrasool <compnerd at compnerd.org>:
> 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 *
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list