ELF: Add a skip() overload to ignore any token

Most functions that return StringRef should check their return values,
so I'm planning on marking StringRef [[nodiscard]]. This requires
splitting up functions like next() that are sometimes just used for
side effects.

llvm-svn: 284363
This commit is contained in:
Justin Bogner
2016-10-17 06:21:13 +00:00
parent 812101d862
commit 5424e7c7dc
3 changed files with 20 additions and 9 deletions

View File

@@ -150,6 +150,16 @@ bool ScriptParserBase::skip(StringRef Tok) {
return true;
}
void ScriptParserBase::skip() {
if (Error)
return;
if (atEOF()) {
setError("unexpected EOF");
return;
}
++Pos;
}
void ScriptParserBase::expect(StringRef Expect) {
if (Error)
return;