[PATCH] R600: Fix up for AsmPrinter's OutStreamer being a unique_ptr

Tom Stellard tom at stellard.net
Tue Apr 28 06:53:29 PDT 2015


On Mon, Apr 27, 2015 at 09:34:53AM -0700, David Blaikie wrote:
> On Mon, Apr 27, 2015 at 2:59 AM, Michel Dänzer <michel at daenzer.net> wrote:
> > From: Michel Dänzer <michel.daenzer at amd.com>
> >
> > Fixes a crash with basically any OpenGL application using the radeonsi
> > driver.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90176
> > Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> > ---
> >  lib/Target/R600/AMDGPUMCInstLower.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/Target/R600/AMDGPUMCInstLower.cpp b/lib/Target/R600/AMDGPUMCInstLower.cpp
> > index b00bd8d..708bb6f 100644
> > --- a/lib/Target/R600/AMDGPUMCInstLower.cpp
> > +++ b/lib/Target/R600/AMDGPUMCInstLower.cpp
> > @@ -132,8 +132,8 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
> >        SmallVector<char, 16> CodeBytes;
> >        raw_svector_ostream CodeStream(CodeBytes);
> >
> > -      MCObjectStreamer &ObjStreamer = (MCObjectStreamer &)OutStreamer;
> 
> Well that's lovely... - anyone have interest in banning c-style casts
> or a Clang warning for essentially reinterpret casts with c-style
> casts? (similar to -Wcast-qual - essentially trying to push for
> c-style casts to only be used for static_cast equivalent operations)
> 

These kinds of casts are used a lot in the target AsmParsers too.  What
kind of cast is correct here?

-Tom

> > -      MCCodeEmitter &InstEmitter = ObjStreamer.getAssembler().getEmitter();
> > +      MCObjectStreamer *ObjStreamer = (MCObjectStreamer *)OutStreamer.get();
> > +      MCCodeEmitter &InstEmitter = ObjStreamer->getAssembler().getEmitter();
> >        InstEmitter.EncodeInstruction(TmpInst, CodeStream, Fixups,
> >                                      MF->getSubtarget<MCSubtargetInfo>());
> >        CodeStream.flush();
> > --
> > 2.1.4
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list