[lld] r287200 - Simplify and use consistent variable name. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 16 19:52:14 PST 2016
Author: ruiu
Date: Wed Nov 16 21:52:14 2016
New Revision: 287200
URL: http://llvm.org/viewvc/llvm-project?rev=287200&view=rev
Log:
Simplify and use consistent variable name. NFC.
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=287200&r1=287199&r2=287200&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Nov 16 21:52:14 2016
@@ -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::vect
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
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(";");
}
More information about the llvm-commits
mailing list