diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-02-18 21:03:07 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-02-18 21:03:07 +0000 |
commit | 0a02e4c4ece4d130408bd565b4020705170f8725 (patch) | |
tree | 9c98236816748b5ea40e7398d290bb76714ffcae | |
parent | 1b024c6c2e7e32b0fc71e4c16a1b19197b329d2a (diff) |
Merging r229719:
------------------------------------------------------------------------
r229719 | d0k | 2015-02-18 10:45:54 -0800 (Wed, 18 Feb 2015) | 8 lines
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!
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_36@229746 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Driver/ToolChains.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 4d97ab3bf4..f789fd5559 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -3154,7 +3154,8 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, 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; |