summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptLexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/ScriptLexer.cpp')
-rw-r--r--lld/ELF/ScriptLexer.cpp13
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)
OpenPOWER on IntegriCloud