[lld] r287944 - Remove a parameter from ScriptParser.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 10:51:55 PST 2016
Author: ruiu
Date: Fri Nov 25 12:51:54 2016
New Revision: 287944
URL: http://llvm.org/viewvc/llvm-project?rev=287944&view=rev
Log:
Remove a parameter from ScriptParser.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=287944&r1=287943&r2=287944&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Fri Nov 25 12:51:54 2016
@@ -81,6 +81,15 @@ template <class ELFT> static void addSyn
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 @@ class elf::ScriptParser final : public S
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 @@ std::vector<SymbolVersion> ScriptParser:
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>;
More information about the llvm-commits
mailing list