[lld] r259186 - Replace StringRef with std::string in LinkerDriver::addLibrary(StringRef Name) because std::string is destroyed after assigning what fills the buffer with garbage and StringRef is no more valid.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 07:30:04 PST 2016


LGTM
2016/01/29 午前2:56 "George Rimar via llvm-commits" <
llvm-commits at lists.llvm.org>:

> Author: grimar
> Date: Fri Jan 29 04:52:52 2016
> New Revision: 259186
>
> URL: http://llvm.org/viewvc/llvm-project?rev=259186&view=rev
> Log:
> Replace StringRef with std::string in LinkerDriver::addLibrary(StringRef
> Name) because std::string is destroyed after assigning what fills the
> buffer with garbage and StringRef is no more valid.
> That fixes few failing tests under windows+msvs2015(debug).
>
> Modified:
>     lld/trunk/ELF/Driver.cpp
>
> Modified: lld/trunk/ELF/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=259186&r1=259185&r2=259186&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Driver.cpp (original)
> +++ lld/trunk/ELF/Driver.cpp Fri Jan 29 04:52:52 2016
> @@ -114,7 +114,7 @@ void LinkerDriver::addFile(StringRef Pat
>
>  // Add a given library by searching it from input search paths.
>  void LinkerDriver::addLibrary(StringRef Name) {
> -  StringRef Path = searchLibrary(Name);
> +  std::string Path = searchLibrary(Name);
>    if (Path.empty())
>      error("Unable to find library -l" + Name);
>    else
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160129/2b34bf49/attachment.html>


More information about the llvm-commits mailing list