diff options
Diffstat (limited to 'lld/ELF/ScriptLexer.cpp')
-rw-r--r-- | lld/ELF/ScriptLexer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp index 8514c2524a3..26e011e9999 100644 --- a/lld/ELF/ScriptLexer.cpp +++ b/lld/ELF/ScriptLexer.cpp @@ -168,7 +168,7 @@ 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. static std::vector<StringRef> tokenizeExpr(StringRef S) { - StringRef Ops = "+-*/:"; // List of operators + StringRef Ops = "+-*/:!"; // List of operators // Quoted strings are literal strings, so we don't want to split it. if (S.startswith("\"")) @@ -189,9 +189,14 @@ static std::vector<StringRef> tokenizeExpr(StringRef S) { if (E != 0) Ret.push_back(S.substr(0, E)); - // Get the operator as a token. - Ret.push_back(S.substr(E, 1)); - S = S.substr(E + 1); + // Get the operator as a token. Keep != as one token. + if (S.substr(E).startswith("!=")) { + Ret.push_back(S.substr(E, 2)); + S = S.substr(E + 2); + } else { + Ret.push_back(S.substr(E, 1)); + S = S.substr(E + 1); + } } return Ret; } |