summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-18 18:45:54 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-18 18:45:54 +0000
commit33cd6dcf87295e4165fe9fca56b078eb686d044a (patch)
tree67a724a834b2e9ad002e68df7a4e127525180a38 /clang/lib
parent568b0de17091aea712d411d15ff2ecf8b947b7c5 (diff)
downloadbcm5719-llvm-33cd6dcf87295e4165fe9fca56b078eb686d044a.tar.gz
bcm5719-llvm-33cd6dcf87295e4165fe9fca56b078eb686d044a.zip
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! llvm-svn: 229719
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/ToolChains.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 845500bf98f..579759e7772 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud