[ELF2] Simplify buildSysrootedPath()
Reviewed by: rafael
llvm-svn: 248885
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 921de4cd..bcc8a6a 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -61,17 +61,14 @@
}
// Makes a path by concatenating Dir and File.
-// If Dir starts with "=" the result will be preceded by SysRoot,
+// If Dir starts with '=' the result will be preceded by Sysroot,
// which can be set with --sysroot command line switch.
static std::string buildSysrootedPath(StringRef Dir, StringRef File) {
SmallString<128> Path;
- if (Dir.startswith("=")) {
- Path.assign(Config->Sysroot);
- sys::path::append(Path, Dir.substr(1), File);
- } else {
- Path.assign(Dir);
- sys::path::append(Path, File);
- }
+ if (Dir.startswith("="))
+ sys::path::append(Path, Config->Sysroot, Dir.substr(1), File);
+ else
+ sys::path::append(Path, Dir, File);
return Path.str().str();
}