[llvm] r229938 - This needs to be a const variable so the two sides of the ternary

Eric Christopher echristo at gmail.com
Thu Feb 26 12:33:51 PST 2015


On Wed, Feb 25, 2015 at 6:16 PM Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2015 Feb 19, at 16:03, Eric Christopher <echristo at gmail.com> wrote:
> >
> > Author: echristo
> > Date: Thu Feb 19 18:03:45 2015
> > New Revision: 229938
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=229938&view=rev
> > Log:
> > This needs to be a const variable so the two sides of the ternary
> > operator agree on type.
> >
> > Modified:
> >    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp?rev=229938&r1=229937&r2=229938&
> view=diff
> > ============================================================
> ==================
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Thu Feb
> 19 18:03:45 2015
> > @@ -152,7 +152,8 @@ void AsmPrinter::EmitInlineAsm(StringRef
> >   // and not have a MachineFunction to initialize the TargetInstrInfo
> from and
> >   // we only need MCInstrInfo for asm parsing.
> >   std::unique_ptr<MCTargetAsmParser> TAP(TM.getTarget().
> createMCAsmParser(
> > -      *STI, *Parser, MII ? *MII : *TM.getTarget().createMCInstrInfo(),
> > +      *STI, *Parser, MII ? *MII : *static_cast<const MCInstrInfo *>(
>
> Can this just be a `const_cast<>`?
>
>
I don't think so (at least I recall trying that first and getting a type
error), that said, the code has changed anyhow to be cleaner/better :)

Thanks!

-eric


> > +                                      TM.getTarget().
> createMCInstrInfo()),
> >       TM.Options.MCOptions));
> >   if (!TAP)
> >     report_fatal_error("Inline asm not supported by this streamer
> because"
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/2ddd8dcf/attachment.html>


More information about the llvm-commits mailing list