diff options
author | George Rimar <grimar@accesssoftek.com> | 2017-08-04 10:34:14 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2017-08-04 10:34:14 +0000 |
commit | ce6080819ce8fe0f9cd77f327814574eb68c0d49 (patch) | |
tree | 1a2ab245d7022f1ca0914ed4b6bbf06d99deeb50 /lld/ELF/ScriptParser.cpp | |
parent | d6bcde389ac3f9dd7fee40a0303e97a8aeb85778 (diff) | |
download | bcm5719-llvm-ce6080819ce8fe0f9cd77f327814574eb68c0d49.tar.gz bcm5719-llvm-ce6080819ce8fe0f9cd77f327814574eb68c0d49.zip |
[ELF] - Remove ScriptLexer::Error field and check ErrorCount instead.
D35945 introduces change when there is useless to check Error flag
in few places, but ErrorCount must be checked instead.
But then we probably can just check ErrorCount always. That should simplify
things. Patch do that.
Differential revision: https://reviews.llvm.org/D36266
llvm-svn: 310046
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 226c67dd203..dee2a02410b 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -192,7 +192,7 @@ void ScriptParser::readVersionScriptCommand() { return; } - while (!atEOF() && !Error && peek() != "}") { + while (!atEOF() && !ErrorCount && peek() != "}") { StringRef VerStr = next(); if (VerStr == "{") { setError("anonymous version definition is used in " @@ -284,7 +284,7 @@ void ScriptParser::readAsNeeded() { expect("("); bool Orig = Config->AsNeeded; Config->AsNeeded = true; - while (!Error && !consume(")")) + while (!ErrorCount && !consume(")")) addFile(unquote(next())); Config->AsNeeded = Orig; } @@ -300,13 +300,13 @@ void ScriptParser::readEntry() { void ScriptParser::readExtern() { expect("("); - while (!Error && !consume(")")) + while (!ErrorCount && !consume(")")) Config->Undefined.push_back(next()); } void ScriptParser::readGroup() { expect("("); - while (!Error && !consume(")")) { + while (!ErrorCount && !consume(")")) { if (consume("AS_NEEDED")) readAsNeeded(); else @@ -345,7 +345,7 @@ void ScriptParser::readOutput() { void ScriptParser::readOutputArch() { // OUTPUT_ARCH is ignored for now. expect("("); - while (!Error && !consume(")")) + while (!ErrorCount && !consume(")")) skip(); } @@ -364,14 +364,14 @@ void ScriptParser::readOutputFormat() { void ScriptParser::readPhdrs() { expect("{"); - while (!Error && !consume("}")) { + while (!ErrorCount && !consume("}")) { Script->Opt.PhdrsCommands.push_back( {next(), PT_NULL, false, false, UINT_MAX, nullptr}); PhdrsCommand &PhdrCmd = Script->Opt.PhdrsCommands.back(); PhdrCmd.Type = readPhdrType(); - while (!Error && !consume(";")) { + while (!ErrorCount && !consume(";")) { if (consume("FILEHDR")) PhdrCmd.HasFilehdr = true; else if (consume("PHDRS")) @@ -403,7 +403,7 @@ void ScriptParser::readSections() { Config->SingleRoRx = true; expect("{"); - while (!Error && !consume("}")) { + while (!ErrorCount && !consume("}")) { StringRef Tok = next(); BaseCommand *Cmd = readProvideOrAssignment(Tok); if (!Cmd) { @@ -428,7 +428,7 @@ static int precedence(StringRef Op) { StringMatcher ScriptParser::readFilePatterns() { std::vector<StringRef> V; - while (!Error && !consume(")")) + while (!ErrorCount && !consume(")")) V.push_back(next()); return StringMatcher(V); } @@ -460,7 +460,7 @@ SortSectionPolicy ScriptParser::readSortKind() { // any file but a.o, and section .baz in any file but b.o. std::vector<SectionPattern> ScriptParser::readInputSectionsList() { std::vector<SectionPattern> Ret; - while (!Error && peek() != ")") { + while (!ErrorCount && peek() != ")") { StringMatcher ExcludeFilePat; if (consume("EXCLUDE_FILE")) { expect("("); @@ -468,7 +468,7 @@ std::vector<SectionPattern> ScriptParser::readInputSectionsList() { } std::vector<StringRef> V; - while (!Error && peek() != ")" && peek() != "EXCLUDE_FILE") + while (!ErrorCount && peek() != ")" && peek() != "EXCLUDE_FILE") V.push_back(next()); if (!V.empty()) @@ -495,7 +495,7 @@ ScriptParser::readInputSectionRules(StringRef FilePattern) { auto *Cmd = make<InputSectionDescription>(FilePattern); expect("("); - while (!Error && !consume(")")) { + while (!ErrorCount && !consume(")")) { SortSectionPolicy Outer = readSortKind(); SortSectionPolicy Inner = SortSectionPolicy::Default; std::vector<SectionPattern> V; @@ -625,7 +625,7 @@ OutputSection *ScriptParser::readOutputSectionDescription(StringRef OutSec) { Cmd->Constraint = ConstraintKind::ReadWrite; expect("{"); - while (!Error && !consume("}")) { + while (!ErrorCount && !consume("}")) { StringRef Tok = next(); if (Tok == ";") { // Empty commands are allowed. Do nothing here. @@ -769,7 +769,7 @@ static Expr combine(StringRef Op, Expr L, Expr R) { // This is a part of the operator-precedence parser. This function // assumes that the remaining token stream starts with an operator. Expr ScriptParser::readExpr1(Expr Lhs, int MinPrec) { - while (!atEOF() && !Error) { + while (!atEOF() && !ErrorCount) { // Read an operator and an expression. if (consume("?")) return readTernary(Lhs); @@ -1033,7 +1033,7 @@ Expr ScriptParser::readParenExpr() { std::vector<StringRef> ScriptParser::readOutputSectionPhdrs() { std::vector<StringRef> Phdrs; - while (!Error && peek().startswith(":")) { + while (!ErrorCount && peek().startswith(":")) { StringRef Tok = next(); Phdrs.push_back((Tok.size() == 1) ? next() : Tok.substr(1)); } @@ -1136,7 +1136,7 @@ ScriptParser::readSymbols() { std::vector<SymbolVersion> Globals; std::vector<SymbolVersion> *V = &Globals; - while (!Error) { + while (!ErrorCount) { if (consume("}")) break; if (consumeLabel("local")) { @@ -1170,7 +1170,7 @@ std::vector<SymbolVersion> ScriptParser::readVersionExtern() { expect("{"); std::vector<SymbolVersion> Ret; - while (!Error && peek() != "}") { + while (!ErrorCount && peek() != "}") { StringRef Tok = next(); bool HasWildcard = !Tok.startswith("\"") && hasWildcard(Tok); Ret.push_back({unquote(Tok), IsCXX, HasWildcard}); @@ -1197,7 +1197,7 @@ uint64_t ScriptParser::readMemoryAssignment(StringRef S1, StringRef S2, // MEMORY { name [(attr)] : ORIGIN = origin, LENGTH = len ... } void ScriptParser::readMemory() { expect("{"); - while (!Error && !consume("}")) { + while (!ErrorCount && !consume("}")) { StringRef Name = next(); uint32_t Flags = 0; |