Remove a parameter from ScriptParser.
llvm-svn: 287944
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index add5b38..51efa2e 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -81,6 +81,15 @@
Cmd->Expression(0) - Sec->Addr;
}
+static bool isUnderSysroot(StringRef Path) {
+ if (Config->Sysroot == "")
+ return false;
+ for (; !Path.empty(); Path = sys::path::parent_path(Path))
+ if (sys::fs::equivalent(Config->Sysroot, Path))
+ return true;
+ return false;
+}
+
template <class ELFT> static void addSymbol(SymbolAssignment *Cmd) {
if (Cmd->Expression.IsAbsolute())
addRegular<ELFT>(Cmd);
@@ -953,8 +962,9 @@
typedef void (ScriptParser::*Handler)();
public:
- ScriptParser(MemoryBufferRef MB, bool B)
- : ScriptParserBase(MB), IsUnderSysroot(B) {}
+ ScriptParser(MemoryBufferRef MB)
+ : ScriptParserBase(MB),
+ IsUnderSysroot(isUnderSysroot(MB.getBufferIdentifier())) {}
void readLinkerScript();
void readVersionScript();
@@ -1907,22 +1917,12 @@
return Ret;
}
-static bool isUnderSysroot(StringRef Path) {
- if (Config->Sysroot == "")
- return false;
- for (; !Path.empty(); Path = sys::path::parent_path(Path))
- if (sys::fs::equivalent(Config->Sysroot, Path))
- return true;
- return false;
-}
-
void elf::readLinkerScript(MemoryBufferRef MB) {
- StringRef Path = MB.getBufferIdentifier();
- ScriptParser(MB, isUnderSysroot(Path)).readLinkerScript();
+ ScriptParser(MB).readLinkerScript();
}
void elf::readVersionScript(MemoryBufferRef MB) {
- ScriptParser(MB, false).readVersionScript();
+ ScriptParser(MB).readVersionScript();
}
template class elf::LinkerScript<ELF32LE>;