Mercurial > hg > CbC > CbC_llvm
diff lld/ELF/ScriptLexer.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
line wrap: on
line diff
--- a/lld/ELF/ScriptLexer.cpp Wed Nov 09 17:47:54 2022 +0900 +++ b/lld/ELF/ScriptLexer.cpp Fri Aug 18 09:04:13 2023 +0900 @@ -120,7 +120,7 @@ // because, in a glob match context, only unquoted tokens are interpreted // as glob patterns. Double-quoted tokens are literal patterns in that // context. - if (s.startswith("\"")) { + if (s.starts_with("\"")) { size_t e = s.find("\"", 1); if (e == StringRef::npos) { StringRef filename = mb.getBufferIdentifier(); @@ -135,12 +135,12 @@ } // Some operators form separate tokens. - if (s.startswith("<<=") || s.startswith(">>=")) { + if (s.starts_with("<<=") || s.starts_with(">>=")) { vec.push_back(s.substr(0, 3)); s = s.substr(3); continue; } - if (s.size() > 1 && ((s[1] == '=' && strchr("*/+-<>&|", s[0])) || + if (s.size() > 1 && ((s[1] == '=' && strchr("*/+-<>&^|", s[0])) || (s[0] == s[1] && strchr("<>&|", s[0])))) { vec.push_back(s.substr(0, 2)); s = s.substr(2); @@ -167,7 +167,7 @@ // Skip leading whitespace characters or comments. StringRef ScriptLexer::skipSpace(StringRef s) { for (;;) { - if (s.startswith("/*")) { + if (s.starts_with("/*")) { size_t e = s.find("*/", 2); if (e == StringRef::npos) { setError("unclosed comment in a linker script"); @@ -176,7 +176,7 @@ s = s.substr(e + 2); continue; } - if (s.startswith("#")) { + if (s.starts_with("#")) { size_t e = s.find('\n', 1); if (e == StringRef::npos) e = s.size() - 1; @@ -196,10 +196,10 @@ // 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("\"")) + if (s.starts_with("\"")) return {s}; // Split S with operators as separators. @@ -219,9 +219,9 @@ // Get the operator as a token. // Keep !=, ==, >=, <=, << and >> operators as a single tokens. - if (s.substr(e).startswith("!=") || s.substr(e).startswith("==") || - s.substr(e).startswith(">=") || s.substr(e).startswith("<=") || - s.substr(e).startswith("<<") || s.substr(e).startswith(">>")) { + if (s.substr(e).starts_with("!=") || s.substr(e).starts_with("==") || + s.substr(e).starts_with(">=") || s.substr(e).starts_with("<=") || + s.substr(e).starts_with("<<") || s.substr(e).starts_with(">>")) { ret.push_back(s.substr(e, 2)); s = s.substr(e + 2); } else {