[llvm-commits] [llvm] r80807 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp

Daniel Dunbar daniel at zuster.org
Wed Sep 2 14:09:51 PDT 2009


Hi Chris,

On Wed, Sep 2, 2009 at 10:37 AM, Chris Lattner<sabre at nondot.org> wrote:
>  MCSymbol *X86ATTAsmPrinter::GetPICBaseSymbol() {
>   // FIXME: the actual label generated doesn't matter here!  Just mangle in
>   // something unique (the function number) with Private prefix.
> -  std::string Name;
> +  SmallString<60> Name;
>
>   if (Subtarget->isTargetDarwin()) {
> -    Name = "L" + utostr(getFunctionNumber())+"$pb";
> +    raw_svector_ostream(Name) << 'L' << getFunctionNumber() << "$pb";
>   } else {
>     assert(Subtarget->isTargetELF() && "Don't know how to print PIC label!");
> -    Name = ".Lllvm$" + utostr(getFunctionNumber())+".$piclabel";
> -  }
> -  return OutContext.GetOrCreateSymbol(Name);
> +    raw_svector_ostream(Name) << ".Lllvm$" << getFunctionNumber()<<".$piclabel";
> +  }
> +  return OutContext.GetOrCreateSymbol(StringRef(Name.data(), Name.size()));
>  }

Note that both SmallString and raw_svector_ostream have a .str()
method which you can use instead of naming StringRef directly (the
ostream version also flushes).

 - Daniel




More information about the llvm-commits mailing list