r211663 - Tools.cpp: Update getLinuxDynamicLinker() to return Twine instead of StringRef, since r211598 has introduced manipulation of return string.

David Blaikie dblaikie at gmail.com
Tue Jun 24 21:51:02 PDT 2014


On Tue, Jun 24, 2014 at 9:34 PM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> Author: chapuni
> Date: Tue Jun 24 23:34:20 2014
> New Revision: 211663
>
> URL: http://llvm.org/viewvc/llvm-project?rev=211663&view=rev
> Log:
> Tools.cpp: Update getLinuxDynamicLinker() to return Twine instead of StringRef, since r211598 has introduced manipulation of return string.

Returning a Twine is risky business (if the expression returned is
anything more than a single Twine then the Twine subexpressions will
be destroyed at the end of the function, leaving the top level Twine
dangling) - was this change fixing a compilation error? What was the
error?

>
> Modified:
>     cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=211663&r1=211662&r2=211663&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Jun 24 23:34:20 2014
> @@ -6929,8 +6929,8 @@ static void AddLibgcc(const llvm::Triple
>      CmdArgs.push_back("-ldl");
>  }
>
> -static StringRef getLinuxDynamicLinker(const ArgList &Args,
> -                                       const toolchains::Linux &ToolChain) {
> +static Twine getLinuxDynamicLinker(const ArgList &Args,
> +                                   const toolchains::Linux &ToolChain) {
>    if (ToolChain.getTriple().getEnvironment() == llvm::Triple::Android) {
>      if (ToolChain.getTriple().isArch64Bit())
>        return "/system/bin/linker64";
> @@ -6964,7 +6964,7 @@ static StringRef getLinuxDynamicLinker(c
>      return "/lib/ld.so.1";
>    } else if (ToolChain.getArch() == llvm::Triple::mips64 ||
>               ToolChain.getArch() == llvm::Triple::mips64el) {
> -    std::string LinkerFile =
> +    Twine LinkerFile =
>          mips::isNaN2008(Args) ? "ld-linux-mipsn8.so.1" : "ld.so.1";
>      if (mips::hasMipsAbiArg(Args, "n32"))
>        return "/lib32/" + LinkerFile;
>
>
> _______________________________________________
> 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