mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
[ELF2] Simplify buildSysrootedPath()
Reviewed by: rafael llvm-svn: 248885
This commit is contained in:
@@ -61,17 +61,14 @@ static std::unique_ptr<InputFile> createFile(MemoryBufferRef MB) {
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user