[cfe-commits] [PATCH] [arm] clean up compiler warnings

Saleem Abdulrasool compnerd at compnerd.org
Tue Dec 11 09:28:23 PST 2012


On Tue, Dec 11, 2012 at 1:58 AM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:

> Should it be for llvm-commits?
>

Yes, sorry, this was meant 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
> >
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121211/124fd9f5/attachment.html>


More information about the cfe-commits mailing list