forked from OSchip/llvm-project
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
This commit is contained in:
parent
568b0de170
commit
33cd6dcf87
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue