ELF: Fix a misuse of Twine::toStringRef
While the toStringRef API almost certainly ends up populating the
SmallString here, the correct way to use this API is to use the return
value.
llvm-svn: 284361
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 8a00e02..54d5a9b 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1018,10 +1018,10 @@
void ScriptParser::addFile(StringRef S) {
if (IsUnderSysroot && S.startswith("/")) {
- SmallString<128> Path;
- (Config->Sysroot + S).toStringRef(Path);
+ SmallString<128> PathData;
+ StringRef Path = (Config->Sysroot + S).toStringRef(PathData);
if (sys::fs::exists(Path)) {
- Driver->addFile(Saver.save(Path.str()));
+ Driver->addFile(Saver.save(Path));
return;
}
}