[lld] r248885 - [ELF2] Simplify buildSysrootedPath()

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 03:39:39 PDT 2015


Author: ikudrin
Date: Wed Sep 30 05:39:37 2015
New Revision: 248885

URL: http://llvm.org/viewvc/llvm-project?rev=248885&view=rev
Log:
[ELF2] Simplify buildSysrootedPath()

Reviewed by: rafael

Modified:
    lld/trunk/ELF/Driver.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=248885&r1=248884&r2=248885&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Sep 30 05:39:37 2015
@@ -61,17 +61,14 @@ static std::unique_ptr<InputFile> create
 }
 
 // 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();
 }
 




More information about the llvm-commits mailing list