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 | 9086a3af5002f50d27375259539fbc0f5aabd7fb (patch) | |
tree | 00df1945567ab5b264ec0cdbd223a39b79fee17e /lld/ELF/ScriptLexer.cpp | |
parent | 11e189628ccc4656b0d482e8575d6a51cef2d2b6 (diff) |
[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
Diffstat (limited to 'lld/ELF/ScriptLexer.cpp')
-rw-r--r-- | lld/ELF/ScriptLexer.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp index 86720de3527..8514c2524a3 100644 --- a/lld/ELF/ScriptLexer.cpp +++ b/lld/ELF/ScriptLexer.cpp @@ -75,9 +75,8 @@ ScriptLexer::ScriptLexer(MemoryBufferRef MB) { tokenize(MB); } // We don't want to record cascading errors. Keep only the first one. void ScriptLexer::setError(const Twine &Msg) { - if (Error) + if (ErrorCount) return; - Error = true; if (!Pos) { error(getCurrentLocation() + ": " + Msg); @@ -164,7 +163,7 @@ StringRef ScriptLexer::skipSpace(StringRef S) { } // An erroneous token is handled as if it were the last token before EOF. -bool ScriptLexer::atEOF() { return Error || Tokens.size() == Pos; } +bool ScriptLexer::atEOF() { return ErrorCount || Tokens.size() == Pos; } // Split a given string as an expression. // This function returns "3", "*" and "5" for "3*5" for example. @@ -207,7 +206,7 @@ static std::vector<StringRef> tokenizeExpr(StringRef S) { // // This function may split the current token into multiple tokens. void ScriptLexer::maybeSplitExpr() { - if (!InExpr || Error || atEOF()) + if (!InExpr || ErrorCount || atEOF()) return; std::vector<StringRef> V = tokenizeExpr(Tokens[Pos]); @@ -220,7 +219,7 @@ void ScriptLexer::maybeSplitExpr() { StringRef ScriptLexer::next() { maybeSplitExpr(); - if (Error) + if (ErrorCount) return ""; if (atEOF()) { setError("unexpected EOF"); @@ -231,7 +230,7 @@ StringRef ScriptLexer::next() { StringRef ScriptLexer::peek() { StringRef Tok = next(); - if (Error) + if (ErrorCount) return ""; Pos = Pos - 1; return Tok; @@ -260,7 +259,7 @@ bool ScriptLexer::consumeLabel(StringRef Tok) { void ScriptLexer::skip() { (void)next(); } void ScriptLexer::expect(StringRef Expect) { - if (Error) + if (ErrorCount) return; StringRef Tok = next(); if (Tok != Expect) |