diff options
Diffstat (limited to 'ELF/ScriptLexer.cpp')
-rw-r--r-- | ELF/ScriptLexer.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/ELF/ScriptLexer.cpp b/ELF/ScriptLexer.cpp index ef5a1cff7590..d4b1f6d99cc1 100644 --- a/ELF/ScriptLexer.cpp +++ b/ELF/ScriptLexer.cpp @@ -66,8 +66,6 @@ size_t ScriptLexer::getColumnNumber() { std::string ScriptLexer::getCurrentLocation() { std::string Filename = getCurrentMB().getBufferIdentifier(); - if (!Pos) - return Filename; return (Filename + ":" + Twine(getLineNumber())).str(); } @@ -116,8 +114,9 @@ void ScriptLexer::tokenize(MemoryBufferRef MB) { } // ">foo" is parsed to ">" and "foo", but ">>" is parsed to ">>". + // "|", "||", "&" and "&&" are different operators. if (S.startswith("<<") || S.startswith("<=") || S.startswith(">>") || - S.startswith(">=")) { + S.startswith(">=") || S.startswith("||") || S.startswith("&&")) { Vec.push_back(S.substr(0, 2)); S = S.substr(2); continue; @@ -282,10 +281,7 @@ static bool encloses(StringRef S, StringRef T) { MemoryBufferRef ScriptLexer::getCurrentMB() { // Find input buffer containing the current token. - assert(!MBs.empty()); - if (!Pos) - return MBs[0]; - + assert(!MBs.empty() && Pos > 0); for (MemoryBufferRef MB : MBs) if (encloses(MB.getBuffer(), Tokens[Pos - 1])) return MB; |