diff options
author | Rui Ueyama <ruiu@google.com> | 2019-07-03 06:11:50 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2019-07-03 06:11:50 +0000 |
commit | 11ae59f0cee2883307a5c1b67db54a832cc2bc35 (patch) | |
tree | 3efb31d29b775549a1830d47c438b4f4b6985cf4 /lld/ELF/ScriptParser.cpp | |
parent | c22e772a286b486c313ab2039409ff50562fd888 (diff) | |
download | bcm5719-llvm-11ae59f0cee2883307a5c1b67db54a832cc2bc35.tar.gz bcm5719-llvm-11ae59f0cee2883307a5c1b67db54a832cc2bc35.zip |
Avoid identifiers that are different only in case. NFC.
Some variables in lld have the same name as functions ignoring case.
This patch gives them different names, so that my next patch is easier
to read.
llvm-svn: 365003
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 0ab2a96c9c8..ab96b8e3773 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -40,14 +40,21 @@ using namespace llvm::support::endian; using namespace lld; using namespace lld::elf; -static bool isUnderSysroot(StringRef Path); - namespace { class ScriptParser final : ScriptLexer { public: - ScriptParser(MemoryBufferRef MB) - : ScriptLexer(MB), - IsUnderSysroot(isUnderSysroot(MB.getBufferIdentifier())) {} + ScriptParser(MemoryBufferRef MB) : ScriptLexer(MB) { + // Initialize IsUnderSysroot + if (Config->Sysroot == "") + return; + StringRef Path = MB.getBufferIdentifier(); + for (; !Path.empty(); Path = sys::path::parent_path(Path)) { + if (!sys::fs::equivalent(Config->Sysroot, Path)) + continue; + IsUnderSysroot = true; + return; + } + } void readLinkerScript(); void readVersionScript(); @@ -118,7 +125,7 @@ private: readSymbols(); // True if a script being read is in a subdirectory specified by -sysroot. - bool IsUnderSysroot; + bool IsUnderSysroot = false; // A set to detect an INCLUDE() cycle. StringSet<> Seen; @@ -131,15 +138,6 @@ static StringRef unquote(StringRef S) { return S; } -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; -} - // Some operations only support one non absolute value. Move the // absolute one to the right hand side for convenience. static void moveAbsRight(ExprValue &A, ExprValue &B) { @@ -1449,8 +1447,8 @@ std::vector<SymbolVersion> ScriptParser::readVersionExtern() { std::vector<SymbolVersion> Ret; while (!errorCount() && peek() != "}") { StringRef Tok = next(); - bool HasWildcard = !Tok.startswith("\"") && hasWildcard(Tok); - Ret.push_back({unquote(Tok), IsCXX, HasWildcard}); + Ret.push_back( + {unquote(Tok), IsCXX, !Tok.startswith("\"") && hasWildcard(Tok)}); if (consume("}")) return Ret; expect(";"); |