r229719 - Driver: Fix use of dangling std::string temporary
Benjamin Kramer
benny.kra at gmail.com
Wed Feb 18 10:56:07 PST 2015
On Wed, Feb 18, 2015 at 7:45 PM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Wed Feb 18 12:45:54 2015
> New Revision: 229719
>
> URL: http://llvm.org/viewvc/llvm-project?rev=229719&view=rev
> Log:
> Driver: Fix use of dangling std::string temporary
>
> What's going on here is that the ternary operator produces a std::string rvalue
> that the StringRef points to. I'd hoped bugs like this were a thing of the past
> with our asan testing but apparently this code path is only used when LLVM is
> configured with a custom --with-c-include-dirs setting.
>
> Unbreaks bootstrapping with GCC5 on Fedora (PR22625), patch by Jonathan Wakely!
Hans,
this should be safe for 3.6, can you squeeze it in?
- Ben
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=229719&r1=229718&r2=229719&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Feb 18 12:45:54 2015
> @@ -3154,7 +3154,8 @@ void Linux::AddClangSystemIncludeArgs(co
> SmallVector<StringRef, 5> dirs;
> CIncludeDirs.split(dirs, ":");
> for (StringRef dir : dirs) {
> - StringRef Prefix = llvm::sys::path::is_absolute(dir) ? SysRoot : "";
> + StringRef Prefix =
> + llvm::sys::path::is_absolute(dir) ? StringRef(SysRoot) : "";
> addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
> }
> return;
>
>
> _______________________________________________
> 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