From: Rui Ueyama Date: Thu, 17 Nov 2016 03:52:14 +0000 (+0000) Subject: Simplify and use consistent variable name. NFC. X-Git-Tag: llvmorg-4.0.0-rc1~4329 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ee25a6973fa49dec89c2ebfa67f3648865562d8;p=platform%2Fupstream%2Fllvm.git Simplify and use consistent variable name. NFC. llvm-svn: 287200 --- diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index f266b44..c188dd9 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1679,10 +1679,8 @@ Expr ScriptParser::readPrimary() { return [=](uint64_t Dot) { return getConstant(Name); }; } if (Tok == "DEFINED") { - expect("("); - StringRef Tok = next(); - expect(")"); - return [=](uint64_t Dot) { return ScriptBase->isDefined(Tok) ? 1 : 0; }; + StringRef Name = readParenLiteral(); + return [=](uint64_t Dot) { return ScriptBase->isDefined(Name) ? 1 : 0; }; } if (Tok == "SEGMENT_START") { expect("("); @@ -1825,11 +1823,10 @@ void ScriptParser::readSymbols(std::vector &V) { if (consume("extern")) readVersionExtern(&V); - StringRef Cur = peek(); - if (Cur == "}" || Cur == "local:" || Error) + if (peek() == "}" || peek() == "local:" || Error) return; - skip(); - V.push_back({unquote(Cur), false, hasWildcard(Cur)}); + StringRef Tok = next(); + V.push_back({unquote(Tok), false, hasWildcard(Tok)}); expect(";"); } } @@ -1851,11 +1848,10 @@ void ScriptParser::readVersionExtern(std::vector *V) { expect("\"C++\""); expect("{"); - for (;;) { - if (peek() == "}" || Error) - break; - bool HasWildcard = !peek().startswith("\"") && hasWildcard(peek()); - V->push_back({unquote(next()), true, HasWildcard}); + while (!Error && peek() != "}") { + StringRef Tok = next(); + bool HasWildcard = !Tok.startswith("\"") && hasWildcard(Tok); + V->push_back({unquote(Tok), true, HasWildcard}); expect(";"); }